Mukul Gandhi <muk...@apache.org> wrote on 02/19/2010 10:59:27 AM:

> Hi Felix,
>    The XSD Schema example you've posted, works fine with the
> schema-dev XSD 1.1 SVN branch.
>
> It seems, you are invoking the Schema validation in XSD 1.0 mode.
> Please try to invoke the validation in 1.1 mode, and then you should
> get the expected results.
>
> I'm aware of following two ways to invoke XSD 1.1 validation with
> Xerces-J (from SVN at present):
>
> 1. Use JAXP validation API, using the XSD 1.1 Schema factory as follows:
> System.setProperty("javax.xml.validation.SchemaFactory:http://
> www.w3.org/XML/XMLSchema/v1.1",
> "org.apache.xerces.jaxp.validation.XMLSchema11Factory");
> SchemaFactory sf =
> SchemaFactory.newInstance("http://www.w3.org/XML/XMLSchema/v1.1";);
> Schema s = sf.newSchema(new StreamSource(args[1]));
> Validator v = s.newValidator();
> v.validate(new StreamSource(args[0]));
>
> 2. Use the jaxp.SourceValidator sample, with -xsd11 flag

This isn't really a second method. It's just a sample demonstrating the
first.

> On Fri, Feb 19, 2010 at 9:02 PM, Felix Nensa <ne...@zeec.biz> wrote:
> > Hi Mukul,
> >
> > I just found some time to compile the latest head revision from
> > xml-schema-1.1-dev and compiled it.
> > But it producues the identical error message as the standard
jre-bundled
> > xerces:
> >
> > org.xml.sax.SAXParseException: cos-all-limited.2: The {max occurs} of
an
> > element in an 'all' model group must be 0 or 1. The value '-1' for
element
> > 'D' is invalid.
> >
> > Do I have to tell it to run in schema 1.1 mode? And if so, how?
> > My test schema looks like this:
> >
> > <?xml version="1.0" encoding="utf-8" ?>
> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
> >            targetNamespace="http://www.zeec.de";
> >            xmlns="http://www.zeec.de";
> >            elementFormDefault="qualified">
> >
> >     <xs:element name="SomeElement">
> >       <xs:complexType>
> >         <xs:all>
> >          <xs:element name="A" type="xs:string" minOccurs="1"
maxOccurs="1"
> > />
> >          <xs:element name="B" type="xs:string" minOccurs="1"
maxOccurs="1"
> > />
> >          <xs:element name="C" type="xs:string" minOccurs="0"
maxOccurs="1"
> > />
> >          <xs:element name="D" type="xs:string" minOccurs="1"
> > maxOccurs="unbounded" />
> >
> >         </xs:all>
> >       </xs:complexType>
> >     </xs:element>
> >
> > </xs:schema>
> >
> > Best regards,
> >
> > Felix
>
> --
> Regards,
> Mukul Gandhi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
> For additional commands, e-mail: j-users-h...@xerces.apache.org

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrgla...@ca.ibm.com
E-mail: mrgla...@apache.org

Reply via email to