SAX - query..

SAX - query..

Post by Sreekant » Wed, 04 Aug 2004 23:26:46


Hello all,

I have a XML file of 10 MB, I do not want to load this file in Memory using
DOM,I know that using SAX I can read the xml file but I want to modify this
XML file.

I want add, delete few nodes, elements or modify the value of attribute....
from XML file based on this I need to modify attribute value in respective
parent nodes.

consider for example,
<root>
<SEQUENCE SQID="2" tag="4,1220" length="415522">
<ITEM IID="2" length="134">
<SEQUENCE SQID="3" tag="4,1220" length="415522">
<ITEM IID="3" length="134">
<DATA_ELEMENT tag="4,1400" VR="AE" length="23"
ProvidedLength="23"><1.2.840.10008.1.3.10
</DATA_ELEMENT>
</ITEM>
</SEQUENCE>
</ITEM>
</SEQUENCE>
<root>
I need to modify ProvidedLength from 23 to 25, this can be done using SAX,
but when I change this value ( 23 to 25)
I need to add 2 ( 25-23) to length in all parent node till I reach the root,
i.e.

1.in ITEM IID ="3", modify length="134" to length="136"
2.in Sequence node with SQID="3",
3.in ITEM IID ="2",
4.in sequence node with SQID="2".

This level is not allways 4...it can be any value

Can I use SAX for this ? I do not want to load 10MB XML into RAM, some time
this file may even cross 100MB or 200 MB

can any one please tell me how to do it?

If this is not the right place, please let me know where to post this?
 
 
 

SAX - query..

Post by Akshai Mir » Fri, 06 Aug 2004 07:16:16

Please post such questions to microsoft.public.xml -- this newsgroup is
meant specifically for the XML for Analysis SDK.

Thanks,
Akshai
--