Elena Litani wrote:
> 
> Edwin Goei wrote:
> > > Note: if application sets validation to true, but the property is
> > > not specified, it is up to an implementation to decide what to validate
> > > against:
> > > validation may occur against DTD or XML Schemas or both.
> >
> > I don't think this would be backward compatible to the previous spec
> > version.  Old apps may want to validate against a DTD and expect an
> > error if instance doc does not reference one.
> 
> First of all, I could not find anywhere in JAXP specs that setting
> setValidation() sets validation against DTD.
> So it was parser/implementation specific.

I would not interpret it that way.  JAXP 1.0 originally supported the
XML REC which refers to validating and non-validating parsers.  JAXP 1.1
was a update but does not mention any other schema language other than
what is in the XML REC itself.  JAXP 1.2 is/will be the first spec that
mentions any other schema language.  So in JAXP 1.1, setValidation()
refers to DTD validation.  In JAXP 1.2 proposed spec, setValidation()
refers to either DTD or XML Schema validation depending on the value of
the "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; DBF
attribute or javax.xml.parsers.SaxParser property.

> 
> And it is not how it worked in Xerces 1. For Xerces1, setting validation
> feature on would also set validation/schema feature on. Thus, via JAXP
> users could not specify: "validate only against DTD, ignore XML Schema".

I agree this is not how Xerces 1 worked and I considered this a bug.  I
posted some messages on this topic earlier.  I believe Neil replied that
he prefered not to change the behavior for Xerces 1.4.4 even though it
was not spec conformant and instead change it for Xerces2.  I'll try and
find the postings in the archives and post it to the list if you want.

> Only if document had DTD and NO XML schema, validation errors against
> DTD were reported.
> So from Jaxp users point of view, they will get the same behavior from
> parser as they used to have.

Suppose an app was written to the JAXP 1.1 spec that wanted to read a
webapp deployment descriptor (DD).  DDs currently require validation to
a particular DTD.  Under past non-XML schema aware parsers, if a
doctypedecl is not included, the parser would generate a validation
error.  This happens even if the DD contains a pointer to an XSD.  Under
the scheme you are proposing, this would no longer be true.  The DD
would validate which may not be the expected behavior when the app was
originally written.

> 
> 
> > > >   1) app wants to validate to DTD as before. If no doctypedecl, then
> > > > error.
> > >
> > > On factory, set validation to true and the schemaLanguage property to
> > > DTD.
> > > In JAXP implementation for Xerces, the parser will be created with
> > > StandartParserConfiguration.
> >
> > In previous version of JAXP, all that was required was to call
> > setValidating(true), so this would not be backward compatible.
> 
> As I said above, setting validation to true in JAXP was also turn on
> schema, so if document had no DTD but had valid XML Schema, the document
> would be validated against XML Schema and user would never see any
> errors against DTD.
> 
> > >
> > > >   2) app wants to validate to XSD. If no XSD association (either using
> > > > doc hint or programmatically) then error.
> > >
> > > On factory, set validation to true and schemaLanguage property to XML
> > > Schema
> > > Namespace.
> > > In JAXP implementation for Xerces, the parser will be created with
> > > DTDXSParserConfiguration.
> >
> > Sounds fine, but when I tried this w/ Xerces2 beta3, there was no error
> > reported.
> 
> It works against the current code in CVS.

Good to hear it's fixed, I've only tested this with beta3.

-Edwin

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to