Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Using SAX to edit an xml file

Posted on 2005-03-01
3
Medium Priority
?
205 Views
Last Modified: 2013-11-23
I am able to parse an xml file, and retrieve data element by element for the program to use, but is it possible using SAX to write back to the xml file?

What I would like to be able to do is add elements to it, or edit attribute values of the elements currently there.  A few tutorials I have read say edit it as a text file, but I'm hoping there is a way with a SAX parser to just insert new elements, and it'll do the rest.  I am using the SAXParserFactory.  Can anyone give me a rough outline of whether its possible?
0
Comment
Question by:ant84
2 Comments
 
LVL 35

Accepted Solution

by:
TimYates earned 375 total points
ID: 13430194
You'd have to build up your new document as text as you parse through the current one, and add things in...

then dump this new XML document over the top of the old one (as a text file)

I *think* :-/
0
 

Author Comment

by:ant84
ID: 13430470
Thanks for the quick reply, thats what a couple of tutorials seemed to suggest but I was surprised there wasn't a better method.  I will sit out a little longer for anyone else, but if not will give you the points.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month10 days, 17 hours left to enroll

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question