473,394 Members | 1,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

XML - loading file

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">&lt;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?

Nov 12 '05 #1
3 2205
Uday wrote:
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.


In .NET this can be done with XmlReader/XmlWriter pipeline. Just read
XML by XmlReader and write modified nodes to XmlWriter.

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #2
Thank you for your response...

but I need to implement using c++

can you tell me how to do using c++...If you have some sample example, it
will be of great help.

"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:uM**************@TK2MSFTNGP10.phx.gbl...
Uday wrote:
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.


In .NET this can be done with XmlReader/XmlWriter pipeline. Just read
XML by XmlReader and write modified nodes to XmlWriter.

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com

Nov 12 '05 #3
Uday wrote:
Thank you for your response...

but I need to implement using c++

can you tell me how to do using c++...If you have some sample example, it
will be of great help.


You can do it in managed C++, it's .NET language.

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Joe | last post by:
Hi Does anyone know of any issues about loading config files for windows forms applications? I have an application that utilizes a config file that holds my database connection string as well...
3
by: Roy Wang | last post by:
hi, My problem is how to determining when the XML file has loaded using javascript. I loaded an xml file using javascript in a web page. The code below is loading the xml file for IE:...
3
by: Holmes | last post by:
Hello Ran into a bit of a problem here and have now exhausted my resources to getting this working What I am trying to do is load and show a simple vb form with a listbox in it Dim...
2
by: Jean Pierre Daviau | last post by:
When I have something like this in a js file. listeImg = new Array(); listeImg = new Image(w,h); listeImg.src = "centre1.jpg"; etc Are the images loaded after the page is loaded? In the same...
2
by: nick.taylor | last post by:
Hi, I've been trying for weeks to figure out this problem. I'm developing a simple Javascript app that loads an XML file from a server, parses the contents, and displays them. But I am...
0
by: speedcoder | last post by:
hi all, i'm stumped. my applet used to load images over the network. (it was actually designed by someone else.) yes, the applet used to load each image file independently over the network and...
2
by: Curious | last post by:
There's a problem with what is displayed on a tab in my UI. At first, it's a message, "loading...". Then it should be replaced with the actual file name on the tab. Now the issue is that it...
15
by: pdhb_1 | last post by:
I'm trying to run Apache2.2.6 with php. However, I keep getting a long list of error messages in the log file indicating that includes are failing. For example, "PHP Warning: PHP Startup:...
5
by: s0suk3 | last post by:
Hi, I wanted to know how cautious it is to do something like: f = file("filename", "rb") f.read() for a possibly huge file. When calling f.read(), and not doing anything with the return...
5
by: DR | last post by:
Why is its substantialy slower to load 50GB of gzipped file (20GB gzipped file) then loading 50GB unzipped data? im using System.IO.Compression.GZipStream and its not maxing out the cpu while...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.