Skip to content
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

Streaming elements not directly below the root #32

Open
lpil opened this issue Jan 31, 2018 · 2 comments
Open

Streaming elements not directly below the root #32

lpil opened this issue Jan 31, 2018 · 2 comments

Comments

@lpil
Copy link

lpil commented Jan 31, 2018

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

@prefiks
Copy link
Member

prefiks commented Jan 31, 2018

No, this is not configurable at this moment

@lpil
Copy link
Author

lpil commented Jan 31, 2018

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants