incremental xml update over network ?

M

marcus

Hi <xml>Gurus</xml> :)

I've a scenario where the system configuration is maintained in the
server as xml dom tree. clients can change the system config either
entirely or in parts. when the client wishes to change it entirely, the
new domtree would be sent to server. OTOH, if the client wishes to
change only partial config, she would send the subtree xml that needs
change. in the following scenario:

<system>
<subsys-0>
<config-0>text</config-0>
<config-1>text</config-1>
</subsys-0>
<subsys-1>
<config-0>text</config-0>
<config-1>text</config-1>
</subsys-1>
<system>

eg: client may change the whole <system> or just system/subsys-0/config-1

I'm not making any assumptions on the depth of the tree for partial
config change. In either case, the server would like to do syntax
validation as well as data type validation as much as possible in the
domparser itself. how would i achieve this goal ?

do i need to comeup with individual dtd's for partial changes ? or
is there a better way to handle this kind of situation ?

my initial thoughts were: client would specify the operation name which
would identify the subtree. eg: client would send the request as part of
text based protocol and specifies that the config change is to
system/subsys-0/config-1 which would map to the dom sub tree. but this
would not solve the validation problems.

if there is a keyword/technology to refer this situation in the xml
world, please let me know. i'm not sure how SOAP would fit into this
scenario ? i'm wiring the server, client and the text protocol..

the target platform is an embedded system and hence small footprint
solution is very necessary.

I apprecate you thoughts/comments/links etc..

//marcus
PS: if this is not the right forum to discuss this, i apologize. and
would appreciate pointers to right forum.
 
M

Martin SChukrazy

Umm there are two broad questions embedded in here
q1) How can i reconcile partial updates to an XML document?
q2) Do i require DTD's for the individual updates?

Answer to the first part (Assuming that the worst case scenario of inserts
or the best case scenario of updates)
==============
A) For the first part, you pretty much have to load the XML document in
memory (SAX or DOM or whatever), parse the changes into memory too (Document
Frament, Node whatever) and then update the changes
to the main document in memory before writing it out.

B) If your configuration file is mapped to RDBMS (through SQL to RDBMS
mapping) then you could technically make changes directly to sql (enforcing
the relationships over there ) and then recreate the entire document
back in your environment..

C) The third option is to use native XML databases (such as Progress's XIS
or even the GNU one). In the case of progress XIS, you can send changes to
a document through what is known as an update gram, which in your
case would mean the document fragment for update.

The advantages of methods B and C are that they provide you ACID properties
for your XML document. The advantage of C over B is that the database is XML
native and hence there is no need for mapping back and forth..

Answer to the second part:
================
For document fragment updates (sub-tree) or of even smaller footprint
updates (footprint refering to the document elements being updated) really
depends on how much error checking you would like to do. If you want to
maintain strict error checking, then yes it would be wise to come up with a
DTD/Schema for the entire document and then another DTD / Schema for the
updates. As far as the latter is concerned, depending on your configuration
you could effectively define all such changes in one DTD (again depends on
your individual situation).

Under the assumption that this is a single document that you multiple
clients can change, you are better of looking at some persistence mechanism
that provides you with the ACID properties..
Hope this helps..
 
M

Martin SChukrazy

my initial thoughts were: client would specify the operation name which
The way to solve the validation problem is
1) To create a copy of the master config document, apply changes and check
for validity.
2) To check validity of the update document based on DTD / Schema
You could technically use a small footprint embedded XML store or a small
footprint Embedded OODBMS
which you could use to solve some of your problems. Its just getting the
right oodbms which embeds the XML
add-ons such as Xpath, XQuery etc to handle this.
 
M

marcus

Hi Martin, Thanks for your helpful reply

Martin said:
Umm there are two broad questions embedded in here
q1) How can i reconcile partial updates to an XML document?
q2) Do i require DTD's for the individual updates?
[snip]
 
P

Patrick TJ McPhee

[Want to have updates involving either a complete document or a fragment
of the document...]

% do i need to comeup with individual dtd's for partial changes ? or
% is there a better way to handle this kind of situation ?

If the partial changes have the same structure as they would have in
the full document, then you can use the same DTD for validation. The
key is to specify the correct top-level element in the document type
declaration. i.e.,

<!DOCTYPE system PUBLIC '-//MYORG//My update//EN'>

for a full update, or

<!DOCTYPE subsys-0 PUBLIC '-//MYORG//My update//EN'>

for a partial update.

I think schemas will work the same way, but you have to be careful to
declare everything such that it can appear as the document element.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,143
Messages
2,570,821
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top