[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Editing Nodes



On Fri, 17 Nov 2000, Alex Ang wrote:
> Hi
> I'll like to know if its possible to edit a particular
> node(example like deleting, adding or changing data of
> a node) in the exsiting document.
> Example like i added test.xml to the db, then i want
> to
> modify the PERSON A.Bagchi to change his EMAIL.Or i
> would like to delete PERSON A.Clark and replace him
> with another PERSON B.RALF whose not in the test.xml
> file(add into db).

After storing a XML document in the XMLContainer, calling the getPDocument()
method gives you a _persistent DOM_. In fact all methods that return any DOM
type (xpath for example) give you persistent nodes. Persistent DOM means you
can use this just as ordinary DOM but all your changes are immediatelly
reflected in the datbase. Like all database objects, the persistent DOM nodes
are just proxies for the real objects in the server. Therefore, handling
persistent DOM from the client is very slow. Before you really work on a stored
XML document, you have to extract it from the database (see sample). If you
really need to change the stored document then there are two options:

1. writing a database object that does the job. A database object runs inside
the server and can handle persistent DOM nodes (which are database objects too)
a 1000 times faster than a client can do.

2. use Lexus! (http://infozone.org/projects_main.html)  Lexus is an
implementation of the XUpdate language specified by http://xmldb.org. XUpdate
allows you to descriptively specify your update operation as XML. This "query"
is than send to the database. The database is then responsible for efficiently
handle this.

I'm about to integrate Lexus into the ozone/XML API. I should be able to check
in something in a few hours.


Falko
-- 
______________________________________________________________________
Falko Braeutigam                              mailto:falko@smb-tec.com
SMB GmbH                                        http://www.smb-tec.com