Aleksandar Milanovic wrote: > Is there a way to validate only parts of documents, e.g. document fragments > whose roots are global elements? This would be very useful in the case when > a small update is done on a very large document (e.g. tens of megs in size).
I presume you keep the document in memory...? Do you use DOM? If so there is a way to revalidate whole document or parts of the document in memory using DOM Level 3 API (normalizeDocument). Otherwise, you can *fake* either SAX or XNI events. You probably don't want to serialize the part of the document you want to revalidate again.. Instead, you can try to walk your memory structure and issue XNI events to the XMLSchemaValidator component. To get an idea how to implement this approach, take a look at the org.apache.xerces.dom.DOMNormalizer (normalizeDocument). This class walks the DOM tree, fixing up namespaces and sending XNI calls to XMLSchemaValidator to validate the tree. The DOMNormalizer is also registered as the XMLSchemaValidator documentHandler so that if XML Schema validation adds some default attribute or element values, DOM could be updated accordingly. Thank you, -- Elena Litani / IBM Toronto --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
