OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Question for updating existing XML file

[ Lists Home | Date Index | Thread Index ]

On Mon, Jul 26, 2004 at 10:13:46AM -0400, Chen, Andrew . wrote:
>    How do you update your XML files?
>    Example:
>      (in a huge XML file...)
>      <Entry>
>       <name>Jon</name>
>      </Entry>
>      ...
> 
>    If I want to update the name to Joe, or add another name Jane.  So the
>    node looks like this:
>      (in a huge XML file...)
>      <Entry>
>       <name>Joe</name>
>       <name>Jane</name>
>      </Entry>
>      ...
> 
>    Is there a way to do this kind of update without rewrite the whole
>    file?  My file is about 50MB.

I have a related question. For a system like this, which allows dynamic
update of a large XML dataset, what would be the most appropriate validation
mechanism to use?

My main concern is this. When you add <name>Jane</name> to the above huge
document, you should not have to revalidate the whole document from scratch.
Rather, you should be able to infer a minimum set of checks against the data
being inserted, and the parent or ancestor elements, to ensure the document
remains valid. For example, in this case perhaps you'd check that 'Jane' is
valid content for <name>, and that the maximum number of <name> children for
<Entry> is not exceeded, before performing the insertion. It shouldn't be
necessary to revalidate the (potentially thousands) of sibling, ancestor or
cousin nodes in the rest of the document.

It looks to me that W3C Schema might be the appropriate mechanism here
(although it's complex, and yet not as flexible as I would like: for
example, maxOccurs can only be a constant value, whereas I'd like it to be
an XPath expression so that the maximum number of occurences can be set in
an attribute of an ancestor node)

Relax-NG might work if you could identify that the parent node matched a
particular production, and continued to match the same production after the
insertion or modification had taken place (thus not requiring any other
nodes to be reparsed). But Relax-NG seems to have some non-deterministic
properties which I think make it difficult to associate a particular node
uniquely with a particular grammar rule, unless you store which rule matched
against each node.

Schematron seems the hardest of them all, since you have a whole bunch of
rules which are applied to the whole document with arbitrary XPath
expressions, so inferring which rules don't need to be retested when you
make a localised change to the document seems to be a difficult problem to
solve.

However I'm no expert in any of the above. Does anyone have any comments on
my conclusions, and also any other suggestions for how to approach this
issue?

Thanks,

Brian.




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS