473,385 Members | 2,014 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,385 software developers and data experts.

appending data to an xml file

I want to append/insert additional data to an xml file.

Context: I use gccxml to parse C header files. gccxml creates an xml
file containing all the definitions from the header files. The xml
files may be somewhat largish, for 'windows.h' it has more than 5 MB.

Since the xml does not contain #define statements, I want to run gccxml
again with the --preprocess and -dM flags, which dumps out the #define'd
symbols.

I want this information also to be in the same file, but simply
appending it to the xml smells hackish, and I don't know if the latter
xml parsing stage can get this additional data with an error handler, or
somehow else. Maybe I can find the end of the xml data myself, before
giving it to the sax parser.

Better, imo, would be to add the dumped info into a proper xml tag, and
inject it into the original file. Is that (efficiently) possible?

Thomas
Jul 18 '05 #1
1 3201
Thomas Heller wrote:
I want to append/insert additional data to an xml file. [...] Better, imo, would be to add the dumped info into a proper xml tag, and
inject it into the original file. Is that (efficiently) possible?


My technique, when I can't just strip the root element and
have a document fragment consisting of a huge list of the
other elements, is just to seek to the end of the file,
back up to the beginning of the '</xml>', and begin overwriting
the file from that point... seems to work nicely, and in
most cases since I'm the one who wrote the file in the first
place I know that I've written '</xml>\n' and can just
seek to the end minus 8 bytes (when on Windows, anyway...).

-Peter
Jul 18 '05 #2

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

Similar topics

1
by: dmiller23462 | last post by:
Hey guys.... I put an error-handling in my page and have it posted at the complete end of the code, see below(when people were putting in 's I was getting the delimiter errors). Great, I...
7
by: Don | last post by:
Hi all, With regards to the following, how do I append the datetimestamp to the filenames in the form? The files are processed using the PHP script that follows below. Thanks in advance,...
16
by: Michael | last post by:
I have a data application in a2k that I need to create two fixed width text files and then combine them to a single file The first file is header information and the second is transaction data. ...
1
by: Anna Warloe | last post by:
This might be a dumb question, but I am pretty new to Access.... I am trying to write code in Access to take river forecasts which are delivered as attachments in emails and append the data into...
2
by: Cat | last post by:
How do you go about appending data from a dataset to an existing xml file? I know you can use WriteXML but this writes over any data already existing in the specified file.. Cat
4
by: jasper | last post by:
How can this be done? Thanks
3
by: Jim | last post by:
Could anyone please point me towards some code that allows me to add to an existing XML file using the output of an HTML form. I want to add a form on my website so users can input their email...
1
by: Frank | last post by:
Hi, Let's say I have a file named myFile.xml Within that file I have blocks of data which I'd like to add at different times during the day. e.g. <LogEntry>
1
by: ofuuzo1 | last post by:
Hi, Is there anyway I can append a new element to an existing xml without first loading the existing file into a variable, adding the new element into the variable and saving it by overwriting the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.