Comments (9)
@yegor256/z please, pay attention to this issue
from jcabi-xml.
@piotrkot this is because the root node is not changed, when you retrieve nodes.get(1)
. Your root is still <root>
from jcabi-xml.
Job gh:jcabi/jcabi-xml#154
is not assigned, can't get performer
from jcabi-xml.
@yegor256 I would like to have it reopened. I had no time to react to your comment.
Let me explain the problem.
Based on the provided XML, all "a" nodes are found with doc.nodes("//a")
.
This indeed finds two "a" nodes, and List<XML> nodes
list contains two XML elements.
With nodes.get(0)
I access the first one and nodes.get(0).xpath("//x/text()").get(0)
is equal to "1".
I expect with nodes.get(1)
I can access the second element from the nodes list. Furthermore, I expect nodes.get(1).xpath("//x/text()").get(0)
to be equal to "2" as stated in the assert. But this is not true. nodes.get(1).xpath("//x/text()").get(0)
is equal to "1".
I believe this is a bug.
Please, explain how does it refer to the root.
from jcabi-xml.
@piotrkot the XPath location //
means "search from the ROOT of the document". Thus, no matter where you are at the moment, it will find you everything that exists in the entire document. This is a feature, not a bug :)
from jcabi-xml.
@yegor256 Now I understand. Replacing xpath("//x/text()")
with xpath("x/text()")
solves my problem.
Thank you (and good to have you back with short response times :) )
from jcabi-xml.
@piotrkot wring.io helps me a lot :)
from jcabi-xml.
@yegor256 Yes, I know. I read you blog regularly :) But this issue was opened for 5 months ;)
from jcabi-xml.
@piotrkot now I'm almost live on GitHub)
from jcabi-xml.
Related Issues (20)
- XMLDocument constructor validation of XML declaration fails on valid XML document HOT 9
- new skin HOT 33
- jacbi-xml library conflicts with use of Hibernate 3.6.10.Final HOT 2
- remove hard-coded link to saxon HOT 5
- take xerces away from tests
- not enough ctors in XSLDocument
- new parent 1.33.0 HOT 4
- refresh HOT 4
- Reusing `TransformerFactory.newInstance()` HOT 2
- compatibility with Saxon 11 HOT 4
- more logs about factories HOT 4
- load XSL only once per XSLDocument HOT 4
- cache of factories in XSLDocument may grow too big HOT 1
- Dependency Dashboard
- improve logging messages HOT 7
- `XSLDocument` is not thread-safe HOT 14
- XSLDocument ctor must accept SystemId in most cases HOT 4
- trace() instead of debug() HOT 3
- XMLDocument.with(Sources) forgets the SID HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jcabi-xml.