Can we insert a new node or edit an XML document using SAX
Paser? If yes how?
Answer Posted / g.h
You could say it is not IMpossible. It just depends on how
the parser is used.
Suppose we made a SAX handler which basically outputs XML
that copies the input being parsed. The handler could be
programmed in such a way that it outputs an additional node
at the right moment. It could also make changes in between
input and output.
However, SAX is not really intended for such operations. We
are not really altering the XML document itself either. SAX
merely reads the XMl text and generates events based on the
input. What we do with those events depends on what the SAX
parser is used for.
If new nodes must be inserted, multiple edits made or
content moved around, the natural fit is DOM: the Document
Object Model. It models an XML document entirely in memory
as an object tree, allowing unlimited alterations. If
necessary, this model can then be outputted to a text-based
XML form again.
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What is xml document?
Define xlink and xpointer?
What is an xslt template?
Is xml a data structure?
What is xsl attribute?
Explain about xml signature?
How can I check that a document conforms to the xml namespaces recommendation?
Which was the first processor related to XSLT?
How do I get my rss feed?
What are the types of web services?
What is the relationship between xml namespaces and the xml 1.0 recommendation?
Define xpath? And what is xslt?
Is xml schema required?
Is html xml subset?
What is the difference between xsl and dsssl?