-
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
Is streaming encoding possible with Saxy? #109
Comments
Note: I am aware about this (Understanding IOData): Lines 136 to 145 in 98e2c9e
Although it is already a nice optimisation, having real streaming would be even better for arbitrarily large & diverse XML documents. |
@thbar |
@thbar , what would it be the elements of the output stream? binary chunks of xml?? this way, you could process these chunks as they come without worrying too much for memory usage ... something like this: # input_file.xml
<root_element>
<item>
<!-- lots of tags and things belonging to "item" that you may want to process -->
....
</item>
<item>...</item>
<item>...</item>
...
</root_element> File.stream!("input_file.xml") |> Saxy.parse_stream(EventParserModule, element: "item") |> Enum.to_list() And something like that??? |
@JoeZ99 re:
I will come back to this a bit later, and will improve my explanation! |
My bandwidth is too limited for this at the moment, but I will likely reopen in the future. Closing to avoid polluting the project! |
Maybe it is already supported, but I'm not 100% clear with this, and I will be very happy to document the findings in a way or another, so opening the discussion :-)
I am currently manipulating potentially large XML responses provided by third-party servers inside a proxy.
Basically, someone queries our proxy with a small XML query, then we modify it, and send the payload to a third-party server.
What I would like to do is stream the response of the third-party server as a client, modify it on the fly (e.g. redacting sensitive elements) and send it back to the client, also in streaming fashion.
This means I would need to stream the large response, but also generate a large streaming encoded document out of it, all with minimal memory.
I think @JoeZ99 paved the way in #100 and https://joez99.medium.com/stream-output-when-parsing-big-xml-with-elixir-92baff37e607, and maybe everything is more or less already here.
Is "streaming encoding" possible currently with Saxy? If I plug this with the above work, I'll have achieved what I need.
Thanks for your input!
The text was updated successfully, but these errors were encountered: