DOM Validation "on-the-fly"

Discussion in 'XML' started by Ghee, Mar 7, 2005.

  1. Ghee

    Ghee Guest

    Hello,

    I have a (java) DOM object that adheres to an XML schema. I want to
    manipulate it in code, but to ensure that the object still sticks to
    the schema (ie, validation during the life-cycle of the DOM object, not
    just upon initial parsing). Is this possible?

    My investigation so far has revealed that DOM3 does provide validation
    mechanisms for this, but no current parsers implement them. I've
    picked up on something called the "post-schema-validation infoset"
    (PSVI), but it looks like another full-blown API to learn - I just want
    (ideally) a flag to indicate that I want the DOM object to reject
    changes that cause it to become invalid.

    I've also seem many other postings on this kind of question, but there
    have never been any replies... Is this the kind of question that shows
    I haven't grasped what XML and friends are all about and you're
    laughing at my lack of understanding (I am new to this and am trying to
    teach myself)? Should I really have another DOM object with the XSD
    document in and use that to manually validate the other object?

    Does anybody have any clues regarding this?

    Ghee
     
    Ghee, Mar 7, 2005
    #1
    1. Advertising

  2. Ghee wrote:


    > I have a (java) DOM object that adheres to an XML schema. I want to
    > manipulate it in code, but to ensure that the object still sticks to
    > the schema (ie, validation during the life-cycle of the DOM object, not
    > just upon initial parsing). Is this possible?


    Java 1.5 allows you to (re)validate a document against a schema by using
    the javax.xml.validation namespace with SchemaFactory, Schema, Validator
    objects and the validate method of Validator.
    I don't see any features in there however to find out whether a certain
    change is allowed in the way DOM Level 3 validation supports it.



    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Mar 7, 2005
    #2
    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. Thorsten Meininger
    Replies:
    0
    Views:
    452
    Thorsten Meininger
    Jul 28, 2004
  2. Thorsten Meininger
    Replies:
    0
    Views:
    522
    Thorsten Meininger
    Jul 28, 2004
  3. mike
    Replies:
    1
    Views:
    1,263
    Martin Honnen
    Nov 20, 2004
  4. Brian

    Fly outmenu on the fly

    Brian, Apr 8, 2005, in forum: Javascript
    Replies:
    0
    Views:
    119
    Brian
    Apr 8, 2005
  5. Replies:
    2
    Views:
    102
    Walton
    Feb 20, 2007
Loading...

Share This Page