Add XPath support #9
Replies: 7 comments
-
Great idea to do it that way. Shouldn't be too hard then. Well, the devil's in the details probably ;) |
Beta Was this translation helpful? Give feedback.
-
My initial thought on an API is something like: let xml = SWXMLParse.xpath(xmlContent, xpathQuery)
// with a definition of xpath(xmlContent: String, xpathQuery: String) -> XMLIndexer A benefit would be avoiding loading all of the XML into memory, but only what was initially returned from the XPath query. Then typical parsing could occur with what was returned via indexing or whatever. Even better, though, it might make sense to add an xpath method on |
Beta Was this translation helpful? Give feedback.
-
Ideally, the entire enum would be lazily constructed in any case. |
Beta Was this translation helpful? Give feedback.
-
At the moment, it parses the entire XML document into memory when It would definitely be better to do the parsing lazily, though. I don't think it would have to actually start parsing until the |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Great point - I hadn't dug in far enough to see that... I think you're right that libxml2 would probably be the better move then. |
Beta Was this translation helpful? Give feedback.
-
Sorry for hijacking into this, for XPath support, it's good to based on libxml2, which has excellent implementation of XPath, something like https://github.com/onmyway133/Reindeers |
Beta Was this translation helpful? Give feedback.
-
Research adding XPath support. I suspect that the code could wrap
NSXMLDocument
to provide this functionality.Beta Was this translation helpful? Give feedback.
All reactions