Title: Validating an already parsed DOM
Typical.. there is always a FAQ to be pointed at =-(
 
I've had a look at DOMNormalizer in 2.4.0 and I can't see where I could plug it to do what I want to do.
 
I am going to download 2.6.1 and attempt to enable the DOM level 3 APIs as it seem the best solution in the long term, and every time I attempt to hook with the internal implementation layer I develop a head ache ;-)
 
Thanks for your help Elena, I'll let you know how it goes.
 

Franck

-----Original Message-----
From: Elena Litani [mailto:[EMAIL PROTECTED]
Sent: 18 February 2004 14:46
To: [EMAIL PROTECTED]
Subject: Re: Validating an already parsed DOM

You can start by looking at Xerces docs [1].

If you can't yet use DOM Level 3 - you can play around with internal DOM Level 3 implementation, in particular DOMNormalizer [2]which is basically traverses the DOM tree and sends XNI events to the XML Schema Validator.

However, please note that the DOMNormalizer is internal implemenation and any such classes (and methods) may change/be removed. So use it at your own risk.


[1] http://xml.apache.org/xerces2-j/faq-dom.html#faq-8
[2] http://cvs.apache.org/viewcvs.cgi/xml-xerces/java/src/org/apache/xerces/dom/DOMNormalizer.java

Thank you,
--
Elena Litani/ IBM Toronto



Wednesday, February 18, 2004 8:08 AM
To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
cc:
From: "Schmidlin Franck, Home" <[EMAIL PROTECTED]>
Subject: Validating an already parsed DOM


Hello there.

I am currently trying to validate XML documents against XSD schemas, using xerces 2_4_0.
It all works beautifully when I validate at parse time, thank you.

However, my particular application requires me to validate documents that are already parsed and in a DOM Document.

I could serialize the DOM to a string and parse that string again, but that seems like a waste.
Even if I were to create a InputSource around the DOM, or a DomReader, by the time I hit the parse() method, we are again processing strings.

I would prefer to by-pass the parsing and just walk the DOM tree to generate whatever (SAX? XNI?) events are required to run the validation.

I am really struggling to find out where is the most appropriate place to plug in my code?

Where should I look for the code that calls the validation?

XMLParserConfiguration seemed like a good place to start, but between interfaces and factories, the decoupling makes it hard to follow the code.

Please note that I am not a xerces source expert, and I do not build it myself: I just peruse the code.

Any help would be much appreciated.

Thanks

Franck



Scanned for viruses by MessageLabs. The integrity and security of this message cannot be guaranteed. This email is intended for the named recipient only, and may contain confidential information and proprietary material. Any unauthorised use or disclosure is prohibited.


Scanned for viruses by MessageLabs


Scanned for viruses by MessageLabs. The integrity and security of this message cannot be guaranteed. This email is intended for the named recipient only, and may contain confidential information and proprietary material. Any unauthorised use or disclosure is prohibited.

Reply via email to