processone / processone/fast_xml
Streaming elements not directly below the root
Nobody has claimed this yet.
- Dominant language
- Erlang
- Stars
- 137
- Forks
- 44
- Avg merge
- 3d 57m
- Merged PRs (30d)
- 1
Description
Hello! First, thank you for this library. I'm very happy with the performance improvement over xmerl.
I have a large XML document I wish to stream, it looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<tns:Envelope xmlns:tns="urn:Service:Integration">
<tns:Body>
<tns:RangeResponse>
<tns:RangeResult>
<tns:Detail> ...more content here... </tns:Detail>
<tns:Detail> ...more content here... </tns:Detail>
<tns:Detail> ...more content here... </tns:Detail>
<tns:Detail> ...more content here... </tns:Detail>
<tns:Detail> ...more content here... </tns:Detail>
<tns:Detail> ...more content here... </tns:Detail>
... and so on...
</tns:RangeResult>
</tns:RangeResponse>
</tns:Body>
</tns:Envelope>
I wish to process each Detail element in turn, getting messages like so:
{'$gen_event', {xmlstreamelement, {xmlel, "Detail", [], ...}}}
However when I stream this document by passing each line to fxml_stream:parse/2 I get a single message containing the Body element, meaning I am parsing and processing the Detail elements eagerly.
Is it possible to instruct fast_xml to use RangeResult as the root?
Thanks,
Louis
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with fxml_stream:parse/2 and the streaming behavior described for the nested RangeResult and Detail elements. Trace how the parser chooses the element included in the emitted xmlstreamelement message, then verify the result against the example document and confirm that each Detail is delivered separately.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- erlang
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100