XML: API manipulating XML DOM-Tree correctly?

R

Ray

Hi,

does anybody know if there is an api or framework, that can manipulate
the DOM-Tree in that manner that the xml stays valid. For example it
should handle to add a child node at the right position if the order
of xml child elements is relevant.

e.g.:
<book>
<title>XML in a Nutshell</title>
<author>Author's Name</title>
<!-- <publisher></publisher> -->
<price>39.99</price>
</book>

If I want to set a publisher the api should automatically set it at
the right position of the element (here between <author> and <price>).
The xerces api for example only offers the method 'insertBefore'.
Ideally element types e.g. int, String or ranges are to be checked
too.

I know there a java xml binding framework like castor or jaxb that can
set elements, but due to memory and performance issue because of big
xsd and xml I would like to manipulate the dom tree directly. So are
there other alternatives?

Thanks.

Regards
Ray
 
M

Martin Honnen

Ray wrote:

does anybody know if there is an api or framework, that can manipulate
the DOM-Tree in that manner that the xml stays valid. For example it
should handle to add a child node at the right position if the order
of xml child elements is relevant.

e.g.:
<book>
<title>XML in a Nutshell</title>
<author>Author's Name</title>
<!-- <publisher></publisher> -->
<price>39.99</price>
</book>

If I want to set a publisher the api should automatically set it at
the right position of the element (here between <author> and <price>).
The xerces api for example only offers the method 'insertBefore'.
Ideally element types e.g. int, String or ranges are to be checked
too.

DOM Level 3 validation provides an API to check for allowed edits e.g.
http://www.w3.org/TR/DOM-Level-3-Val/validation.html#VAL-Interfaces-ElementEditVAL
Oracle has an implementation:
http://otn.oracle.com/tech/xml/xdk/xdkbeta.html
 
R

Ray

Martin Honnen said:
Ray wrote:



DOM Level 3 validation provides an API to check for allowed edits e.g.
http://www.w3.org/TR/DOM-Level-3-Val/validation.html#VAL-Interfaces-ElementEditVAL
Oracle has an implementation:
http://otn.oracle.com/tech/xml/xdk/xdkbeta.html

Thanks Martin,

i tried the implementation, but have the same problem you posted in
the otn forum:
http://forums.oracle.com/forums/thr...q=676574416c6c6f7765644368696c6472656e#656210

In the meantime did you get any solution for that problem or sample
code?

Greetings
Ray
 

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

Similar Threads


Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top