JuliaIO / LibExpat.jl

Julia interface to the Expat XML parser library
Other
9 stars 32 forks source link

RFC: xpath basic #4

Closed vtjnash closed 11 years ago

vtjnash commented 11 years ago

I believe this is ready to merge, as soon as you are content with it, to provide minimalistic xpath functionality. This ended up altering more than I had initially anticipated, in order to handle the way xpath does indexing. If you would prefer, I'm open to ideas that would provide both API's for ParsedData.

amitmurthy commented 11 years ago

Oops. This is breaking a lot of my existing code, where I was parsing the ParsedData object assuming elements to be a dict of vectors.

Is it possible to keep the old structure of ParsedData with the new xpath stuff?

Also, any reason why you removed the differentiation between XML <![CDATA[ and plain text?

vtjnash commented 11 years ago

pd["name"] has the same return value as pd.elements["name"] used to have. but it's up to you, I could add a compat::Int parameter to xp_parse which ensuring versioning is always available within the LibExpat module

I reorganized stuff this way because of how the XML XPath spec is designed: (a) It counts/selects elements in document order for a few operations, so I removed the elements dictionary in favor of preserving that. (b) It does not differentiate between text and cdata -- they are simply considered complementary ways of entering textual content