c# xml processing

G

gigs

hi!

generic xml:
<obrazac>
<odjeljak sifra="G.5">
<red num="1">
<text id="1">neki text</text>
</red>
<red num="2">
<stupac>
<checkbox id="5-1">text koji ide sa checkboxom</checkbox>
</stupac>
<stupac>
<text id="5-2">sfdgygasg</text>
<br />
<unos id="5-3" />
</stupac>
</red>
</odjeljak>
<odjeljak sifra="G.6" />
</obrazac>


other xml:, i have 20 xml like this. structure is sabe, but elements are in
different order
<obrazac>
<odjeljak>
<text>sudjelovanje</text>
<br />
<text>Datum: </text>
<unos id="29" />
<text>vrijeme: </text>
<unos id="30" />
</odjeljak>
<odjeljak sifra="G.5" />
<odjeljak>
<text>Ostali: </text>
<unos id=".31" />
</odjeljak>
<odjeljak>
<text>ponuda</text>
<br />
<text>Datum: </text>
<unos id="32" />
<br />
<checkbox id="C.14">Da</checkbox>
<checkbox id="C.15">Ne</checkbox>
<br />
<unos id="35" />
</odjeljak>
<odjeljak sifra="I.1">
<redovi od="1" do="7" />
</odjeljak>
</obrazac>



all i just want is to go trough other xml and check <odjeljak> for attribute.
if there is attribute, but no child i write from generic xml <odjeljak> with
same attribute to third xml, if there is child i do some processing and than
write it to third xml. if <odjeljak> from other xml doesnt have attribute i
write him to third xml.

what is the best approach to do that?


i have tried with XPath and XmlTextWriter
 

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

Top