Comments (1)
The path is from the start element that's currently at the front of the range. In your last example there, result
starts on <carrot>
. The only child element that <carrot>
has is <foo>
. So, any path from <carrot>
must start with "foo"
. If you gave the path "foo/bar/ban"
, then your last line would print
foo: ban
Right now, what's happening is that because you gave an invalid path, skipToPath
returns an empty range, and foo.empty
is true
. So, it's not actually valid to call foo.front
at that point. It just so happens that front
returns the end tag, because front
doesn't assert that it wasn't called when the range was empty, and the end tag was the last data it had before the end of the range was reached. If foo.front
asserted that the range was not empty, then you'd be getting an assertion failure when you attempted to call foo.front
. After you call skipToPath
, you should be checking whether the return value is empty
so that you know whether it actually found the path that you requested. And for the path to be correct in that last example, you would either have to pop off the first element so that you were on <foo>
before calling skipToPath("bar/ban")
, or you would have to call skipToPath("foo/bar/ban")
.
For your real data, for "protocolLot/applications"
to be the right path, <ns2:fcsProtocolEF3 schemeVersion="8.1">
would have to be the first element in the range, whereas I'm guessing that you were on its parent start tag <ns2:export ...>
, which would mean that the path would need to be "ns2:fcsProtocolEF3/protocolLot/applications"
.
from dxml.
Related Issues (20)
- Utilize Phobos skipOver HOT 1
- Can't build => can't use HOT 7
- Convienience methods suggestions for DOM parser HOT 4
- dom: Entities consisting of whitespace do not capture their contents HOT 2
- Assert descriptions HOT 2
- Parsing xml without loading the whole file into RAM HOT 5
- parser.d(1925): [1:1]: Expected < HOT 2
- How to get position of end tag? HOT 1
- stripIndent removes text
- stripIndent removes any run of the "right" number of whitespaces HOT 2
- need a shorter way to reach attributes of Entities. HOT 1
- decodeXML does not compile when given a range of type char[] HOT 2
- parser.d(2726): [1:1273]: There can only be whitespace between an end tag's name and the > HOT 4
- Parser fails to operate on UTF8 Files containing a BOM HOT 1
- Compiling with GDC-10.3.0, invalid UTF characters
- Characters legal in XML 1.1 are not accepted
- Change writer.output to finish() HOT 3
- namespace support HOT 10
- Fuzz target for `parseXML` with 2 crashing testcases HOT 7
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 dxml.