Dave, Thanks, for the second one "XMLUni::fgXercesSchema", can you just tell me when it should be set to true?
So in my case, I just need to set XMLUni::fgSAX2CoreValidation to true, and leave others unchanged? thanks, On 6/17/08, David Bertoni <[EMAIL PROTECTED]> wrote: > > Alexi Zuo wrote: > >> *I am writing a schema validation tool to make the content of a XML file >> is >> consistent with a XSD file. Although I can make it work, but I still don't >> know what the following SAX2 features exactly mean. >> > ... > >> *Can anybody tell me what they eactly mean, and when I should set them to >> true (or false)? * >> ** >> *1. XMLUni::fgSAX2CoreNameSpaces* >> *Predefined Constant: * *fgSAX2CoreNameSpaces * *note: * *If the >> validation feature is set to true, then the document must contain a >> grammar >> that supports the use of namespaces. * >> * * >> *But what is a grammar that supports the use of namespaces?* >> > XML Schema requires namespace support to be enabled. > > *2.XMLUni::fgXercesSchema* >> *http://apache.org/xml/features/validation/schema * *true: * *Enable >> the >> parser's schema support. * *false: * *Disable the parser's schema >> support. * >> *What does it mean by "a parser that supports schema"?* >> > I don't see the text "a parser that supports schema" anywhere on the page. > > >> *3.XMLUni::fgSAX2CoreNameSpacePrefixes* >> *http://xml.org/sax/features/namespace-prefixes * *true: * *Report the >> original prefixed names and attributes used for Namespace declarations. >> * >> *false: * *Do not report attributes used for Namespace declarations, and >> optionally do not report original prefixed names. * >> *Can anybody give me an example for this?* >> > When this feature is set to true, any attributes that define namespace > bindings appear in the attributes list for the element. If set to false, > they are not report as attributes, and are only reported through > startPrefixMapping() and endPrefixMapping() events. For example: > > <foo xmlns:bar="http://www.bar.com" /> > > If this feature is set to false, the attribute list for this element will > be empty. If set to true, it will contain one attribute. > > ** >> ** >> *4.XMLUni::fgXercesSchemaFullChecking >> * >> > ... > >> *This feature is only used to check grammar in the XSD file?* >> > Yes > > ** >> *5.XMLUni::fgXercesDynamic* >> *http://apache.org/xml/features/validation/dynamic * *true: * *The >> parser will validate the document only if a grammar is specified. ( >> http://xml.org/sax/features/validation must be true). * *false: * >> *Validation >> is determined by the state of the >> http://xml.org/sax/features/validationfeature. >> * *default: * *false * *XMLUni Predefined Constant: * *fgXercesDynamic >> * *see: * *http://xml.org/sax/features/validation*< >> http://xerces.apache.org/xerces-c/program-sax2.html#validation> >> * * >> The "true" and "false" clauses seems say the same thing? >> > No. If dynamic validation is set to true, and validation is set to true, > validation will only occur if a grammar is found. If dynamic validation is > set to false, and validation is set to true, then validation will always > occur, possibly leading to validation errors if a document doesn't have a > grammar. > > Dave >
