-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get tag content at :end_element #73
Comments
@augnustin I'm happy to help. Could you provide the full structure of the XML document you're going to parse and what you want to achieve with it? |
Hello @qcam Thanks for support. As a disclaimer I want you to know that I finally sorted myself out with The XML looks like:
For each fiche, I'd like to extract some of the fields, like:
Please don't help on how to implement this as I wouldn't need it, but do you think it would make sense to get the textual content of the Cheers |
Hi, awesome to hear that you've found a solution! 🎉 In general, how Saxy works is that it tries to emit the tags and content on the way when the given XML document is being parsed, as events. So basically we don't need to get the textual content (then parse and extract useful data later), but you can do all of them on the fly when parsing the XML document. To do so we need a handler, which will try to turn the emit events into something meaningful and useable. You could read more about the usage here https://hexdocs.pm/saxy/1.2.1/getting-started-with-sax.html#content. As for memory overload, Saxy tries to avoid copying and generating new binary as much as possible during parsing. I think Saxy is one of the most memory efficient XML parsers (at least I try hard to make it so). Benchmarking shows that it usually uses much less memory than other parsers. You could check out the most recent benchmark for memory usage at https://github.com/qcam/saxy/runs/1173353227. Furthermore, if the XML document is too big to fit into memory, Saxy supports streaming parsing, which basically means you could stream your XML file as chunks (let's say 1MB per chunk) and feed them gradually to the parser, while extracting data on-the-fly, using the Hope it helps! Have a good time :). |
Hey,
I'm having memory issues with SweetXML
Your library looks great and performant, but I'm struggling to get what I'd like. I have a huge list of
<FICHE />
elements, and I need to process those independently hence having a map of it's content would definitely do the job:Eg.
But it doesn't seem possible, is it?
Thanks
The text was updated successfully, but these errors were encountered: