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

stream with multiple input #30

Open
broncha opened this issue Jul 14, 2016 · 1 comment
Open

stream with multiple input #30

broncha opened this issue Jul 14, 2016 · 1 comment

Comments

@broncha
Copy link

broncha commented Jul 14, 2016

Hi,
I have multiple input to xml. When I close on of the input stream, closing other has no effect. I dont get the closing tag for the last element

kml = xml.element({ _attr: { xmlns: 'http://www.opengis.net/kml/2.2'} });
doc = xml.element({})

stream = xml([{kml: kml}, {Document: doc}], {declaration: true})

stream.on 'data', (chunk) ->
  console.log(chunk);

doc.close()
kml.close()

And here is the output

<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
</Document>

Closign tag for kml is missing

@broncha
Copy link
Author

broncha commented Jul 14, 2016

I think I found the issue here. The first element should be the one that should end the stream when closing

if (i + 1 === input.length)
    last = end;
add(value, last);

should be

if (i == 0)
    last = end;
add(value, last);

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

No branches or pull requests

1 participant