XML: API manipulating XML DOM-Tree correctly?

Discussion in 'Java' started by Ray, May 14, 2004.

  1. Ray

    Ray Guest

    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
    Ray, May 14, 2004
    #1
    1. Advertising

  2. 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
    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, May 15, 2004
    #2
    1. Advertising

  3. Ray

    Ray Guest

    Martin Honnen <> wrote in message news:<40a62fb5$0$1870$-online.net>...
    > 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


    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
    Ray, May 18, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joris Gillis
    Replies:
    2
    Views:
    1,533
    Joris Gillis
    Jun 16, 2006
  2. Stub

    B tree, B+ tree and B* tree

    Stub, Nov 12, 2003, in forum: C Programming
    Replies:
    3
    Views:
    10,110
  3. Dave Boland
    Replies:
    0
    Views:
    439
    Dave Boland
    Apr 7, 2005
  4. jab3
    Replies:
    2
    Views:
    107
  5. Peter Michaux

    Manipulating the DOM during page load.

    Peter Michaux, Dec 6, 2006, in forum: Javascript
    Replies:
    1
    Views:
    92
    naixn
    Dec 6, 2006
Loading...

Share This Page