Inserting Node in XML Using SAX

Hello

Everybody.

I want to insert some nodes in xml file along with some attributes as well as text data.

I have successfully inserted them using DOM.

But now i want to do it using SAX.

So can anybody here tell me, whether i can insert node in xml using SAX. And whether it is possible / feasible to use SAX for inserting / manipulating xml file.

Thanx in adavance.

Waiting for reply.

[433 byte] By [milindashtekara] at [2007-11-26 14:36:46]
# 1
SAX allows you to read data from frin an XML document.you don't use it to create or alter one.hope that helps,discussjava.com
discussjava.com_a at 2007-7-8 8:17:42 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

Thanx discussjava.com_n for the reply.

I searched many topics in this forum as well as in google for inserting / altering xml with SAX. And you were right we cant insert new node or alter with SAX.

But there must be some way out....

May be by reading the xml file with SAX, and saving it temp file.

Then modify through IO operations and at last writing modified file to the xml file.

Can't we do like this. Or is there any other way out...

Waiting for repy.

milindashtekara at 2007-7-8 8:17:42 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3
IMHO if you insist on using SAX you should first make identity transformation based on SAX, then modify it to detect place where you want to add new code and append the new code to output.
Rostislav_Matla at 2007-7-8 8:17:42 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 4
Thanx Rostislav_Malt for your reply.I dont have any idea about identity transformaton. Till now i have used only DOM. SAX is new for me.Can you please post some link/reference or kinda example to understand identity transformation.Waiting for reply
milindashtekara at 2007-7-8 8:17:42 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 5
It's quite evident that you don't have a clue about Java and XML. Nothing wrong with that, but asking random questions on a forum isn't going to change that very fast. Read a book on the topic. Try this one, for
DrClapa at 2007-7-8 8:17:42 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...