matthewmatician / xml-flow

An XML/HTML stream reader, now with less suck!
MIT License
55 stars 18 forks source link

XML is flattened #39

Open BannerwiseMZL opened 2 years ago

BannerwiseMZL commented 2 years ago

Is there a reason the following XML is flattened?

`

https://example.com/image

`

result is: { image: 'https://example.com/image'}

And if there's a reason can I bypass that behaviour easily?

DrunkenBeetle commented 1 year ago

@BannerwiseMZL is this still an issue? Using the latest works for me with your example xml (v1.0.4)

const flow = require('xml-flow');
const { Readable } = require('stream');
const inFile = Readable.from(['<image> <url>https://example.com/image</url> </image>']);
const xmlStream = flow(inFile);

xmlStream.on('tag:image', console.log);

The above outputs this:

{ '$name': 'image', url: 'https://example.com/image' }