Say I have a document like this:
<Section>
<Some Stuff attribute="something1"/> Some text
<Some Stuff attribute="something2"/> Some more text
<Some Stuff attribute="something3"/> Some other text
</Section>
It does not seem to be valid XML, at least that's what I was told. I would now like to go through this document and grab the tags as well as the text and create some new structure from this. I do not want to keep this order, but re-arrange things in a systematic manner. - So I simple parser function (to JSON or so) won't do.
How could I grab / go through all the elements in nodejs and then rearrange them anew?
I would like to find some kind of library with which I can say, e.g.:
Go to the first section, if there are elements, grab what comes after them until the next element comes and so on.
via George Welder
No comments:
Post a Comment