[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Adding nodes without modifing non-infoset of a document

  • To: xml-dev@l...
  • Subject: Adding nodes without modifing non-infoset of a document
  • From: "Kurt Riede" <kriede@u...>
  • Date: Thu, 21 Apr 2005 17:18:58 +0200
  • Organization: http://freemail.web.de/

adding nodes in xml
I want to add some elements to an existing XML document at well defined positions without modifing the concret representation of the XML document.
Especially I want to keep the overall 'formatting' of attributes and the indentation. Generally speaking, the so-called non-infoset
(see http://lists.xml.org/archives/xml-dev/200504/msg00340.html)
should remain unchanged.
My programming language is Java.

What is the best way?
- If I use DOM or SAX, the formatting of the attributes and others will be lost.
- Manually parsing the XML is a pain.

I'm thinking about a hybrid solution:
- parse the document with SAX,
- keep track of the location in the file with a Locator,
- generate new DOM nodes in the SAX ContentHandler at the defined position(s),
- stream out the original byte stream, mixed with the new nodes at the appropriate locations.
Seems to be less pain, but still looks rather complicated.

Do you have any better suggestions?
Is there something similar to SAX events that also regards the non-infoset? 


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.