how do i split an xml file using c++ (and the sax parser)

V

vin b

given a file such as
<parent name="john">
<child>a</child>
<child>b</child>
<child>c</child>
</parent>

<parent name="james">
<child>a</child>
</parent>

<parent name="jim">
<child>d</child>
<child>a</child>
</parent>

, how would i split it, using c++ to 3 files corresponding to the
<parent....> </parent> segments?

thanks, vin
 
V

Vityok

In your example it's just splitting an input stream into parts with
empty line separator.

For a more generic case, I think you will have to either process SAX
events, or serialize different DOM nodes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top