[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
proposal : XML update language
Hi,
our intention is to create our own XML update language. I have written down my
first ideas.
Andreas
<?xml version="1.0"?>
<example version="1.0">
<adress name="Andreas">
<fullname>Andreas Laux</fullname>
<street>where I live</street>
<zipcode>D-04229</zipcode>
<town>Leipzig</town>
</adress>
</example>
<?xml version="1.0"?>
<updates version="1.0">
<file name="/home/andreas/xmlupdate/example/example.xml" >
<remove select="//adress/street"
/>
</file>
</updates>
<?xml version="1.0" encoding="UTF-8"?>
<example version="1.0"> <adress name="Andreas">
<fullname>Andreas Laux</fullname>
<zipcode>D-04229</zipcode> <town>Leipzig</town> </adress> </example>
Author
------
Andreas Laux <andreas@smb-tec.com>
Status
------
Working-Draft 2000-08-18
Abstract
--------
This documents describes my first idea to update a document which is stored in
a database.
Introduction
------------
To perform an update we must have a syntax that describes the updates. All
updates are described in a XML-file. This update file is parsed by a SAXParser
to get the information and to perform all updates. The updates are specified
at some clients and the updates are performed at the server.
Design
------
At first we need a syntax, written in a file (update.xml).
<?xml version="1.0"?>
<updates version="1.0">
<file name="the fully specified name of the file and its location">
<!--removes the selected node-->
<remove select="a XPath expression"
/>
<!--adds into the selected node to the given location the new element
or attribute or pure text-->
<add select="a XPath expression">
<!--adds the element and its given structure-->
<element name="a new element">
<attribute name="a attribute of the new element"
value="and its value"
/>
<text>
and some text
</text>
</element>
<!--adds the given attribute-->
<attribute name="a new attribute" value="and its value"
/>
<!--adds the given text-->
<text>
the text to add
</text>
</add>
<!--changes the given node-->
<!--update select="a true XPath expression">
the changed text
</update-->
</file>
<file name="...">
<!--updates of another file-->
</file>
</updates>
Now we need a content handler that is analyzing the syntax and a class to
perform these updates. The file in the database is represented by a DOM tree.
So we can select all nodes by a XPath expression. The updates can
directly performed on the DOM tree.
Conclusion
----------
Just for testing I implemented the function <remove> and run a simple example.
I attached three XML files. The example.xml is the file I stored in the
ozone database. The updates.xml is the update I performed. And the result.xml
is the file I read out the database after perfoming updates. Have a look.
Feedback and contribution
-------------------------
Feedback on this paper and contribution is very welcome at ozone-users@ozone-db.org.
References
----------
[dom] - Document Object Model Level 2 (http://www.w3.org/TR/DOM-Level-2/)