Insert element into XML with compliance to a schema

Discussion in 'XML' started by Leura, Jul 14, 2003.

  1. Leura

    Leura Guest

    I have a new XML document parsed in as DOM. Then I have an element to insert
    according to the order spesified in a schema.

    For example:

    I have a XML:


    I need to insert "<book><chapter2>Chapter2></chapter2></book>". Accoding to
    schema, the <chapter2> must be after <chapter1> and before <chapter3> that
    is missing in this case.

    (if I know the element to be insert at a certain position, in this case the
    second, it's easy to do. However, generally the position is not known, only
    an order determined by the schema.)

    How can I generally solve this problem? Is there any way to read in the
    schema and perform the insertion according to it?
    Leura, Jul 14, 2003
    1. Advertisements

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.

Share This Page