kris2006 <[EMAIL PROTECTED]> wrote on 12/11/2006 07:21:33 PM: > Michael, > > Thank you for your lightning response. > > I was able to cast my jaxp Validator object as a PSVIProvider, in theory > giving me access to the getElementPSVI() methods to find the value of > validationAttempted, as you've suggested. However, getElementPSVI() returns > a null, I presume since it is only valid within the start/end of the > element, and I am simply using: > > ... > Schema schema = schemaFactory.newSchema(schemaSource); > Validator validator = schema.newValidator(); > validator.validate(streamSource); > > and so no longer have a context for getElementPSVI().
Right. Specifically the Javadoc [1] for getElementPSVI() says: "The method must be called by an application while in the scope of the methods which report the start and end of an element. For example, for SAX the method must be called within the scope of the document handler's startElement or endElement call. If the method is called outside of the specified scope, the return value is undefined." > Any idea how do I could return a valid ElementPSVI? So you need to write a SAX content handler which receives the output from the Validator (SAXSource/SAXResult) or ValidatorHandler. Within the scope of the startElement/endElement callbacks of your content handler you would query the PSVIProvider. > Thanks again for your help... > > Regards, > Kris [1] http://xerces.apache.org/xerces2-j/javadocs/xs/org/apache/xerces/xs/PSVIProvider.html#getElementPSVI() > Michael Glavassevich wrote: > > > > kris2006 <[EMAIL PROTECTED]> wrote on 12/07/2006 12:28:21 AM: > > > >> I am looking for the set of valid Features for the Xerces implementation > > of > >> the JAXP Validator class. The Features described in > >> http://xerces.apache.org/xerces2-j/features.html pertain to > > DocumentBuilder > >> and SAXParser. > > > > That's been on my TODO list for awhile. Just haven't been finding the time > > to write it up. > > > >> I have tried using one of the general features listed there > >> (http://apache.org/xml/features/validation/warn-on-undeclared-elemdef) > > but > >> it is not recognised for either Validator or SchemaFactory classes. > > > > That feature only applies to DTDs. It warns [1] you when the content model > > of an element declaration references an element which has not been > > declared in the DTD. > > > >> In particular I would like to validate a soap envelope that contains a > > xml > >> string as its body - using both the SOAP-ENV schema and the relevant > > schema > >> of the enveloped xml. This works, but if the wrong schema is specified > > for > >> the enveloped xml the soap still validates! I think the feature > > mentioned > >> above would warn if the schema was incorrect and so would solve my > > problem. > >> Any other suggestions appreciated... > > > > You should examine the PSVI [2] if you want to check the degree [3] to > > which the SOAP message was validated. > > > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > > > > [1] http://www.w3.org/TR/2006/REC-xml-20060816/#elemdecls > > [2] http://xerces.apache.org/xerces2-j/faq-xs.html#faq-8 > > [3] > > http://www.w3.org/Submission/2004/SUBM-xmlschema-api-20040309/xml- > schema-api.html#ItemPSVI-validationAttempted > > > > > > Michael Glavassevich > > XML Parser Development > > IBM Toronto Lab > > E-mail: [EMAIL PROTECTED] > > E-mail: [EMAIL PROTECTED] > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > -- > View this message in context: http://www.nabble.com/Validator- > features-tf2772590.html#a7824915 > Sent from the Xerces - J - Dev mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]