[XML-SIG] Re: Could somebody help me?

Uche Ogbuji Uche.Ogbuji at fourthought.com
Fri Jan 28 16:20:36 CET 2005

On Fri, 2005-01-28 at 15:48 +0530, Prasad PS wrote:
> So for each appending of node, the file is opened and the new root
> document with the appeneded node is re-written to the file. This is
> taking lot of time. 
> Is there any way to append a node to the xml file without re-writing the
> file?

You should be able to manipulate the DOM all you want, before re-writing
the finished update.

But just to throw out another suggestion, 4Suite [1] supports XUpdate
[2].  See also [3].

Here's an XUpdate for the "<a><b/><b/></a>" -> "<a><b/><b/><b/></a>"
transformation I just showed in Amara:

<xupdate:modifications version="1.0"
   <xupdate:append select="/a" >
      <xupdate:element name="b"></xupdate:element>

Think of it like a patch (if you're a UNIX head).

You could build up your XUpdate file bit by bit while running through
your code, and then run the resulting XUpdate whole-sale against the
original file.  This is a technique that's worked very well for us in
similar cases.

[1] http://4suite.org
[2] http://www.xmldatabases.org/projects/XUpdate-UseCases/
[3] http://uche.ogbuji.net/tech/akara/nodes/2004-09-30/xupdate

Uche Ogbuji                                    Fourthought, Inc.
http://uche.ogbuji.net    http://4Suite.org    http://fourthought.com
Use CSS to display XML - http://www.ibm.com/developerworks/edu/x-dw-x-xmlcss-i.html
Introducing the Amara XML Toolkit - http://www.xml.com/pub/a/2005/01/19/amara.html
Be humble, not imperial (in design) - http://www.adtmag.com/article.asp?id=10286
UBL 1.0 - http://www-106.ibm.com/developerworks/xml/library/x-think28.html
Manage XML collections with XAPI - http://www-106.ibm.com/developerworks/xml/library/x-xapi.html
Default and error handling in XSLT lookup tables - http://www.ibm.com/developerworks/xml/library/x-tiplook.html
Packaging XSLT lookup tables as EXSLT functions - http://www.ibm.com/developerworks/xml/library/x-tiplook2.html

More information about the XML-SIG mailing list