Re: Schema 1.1 support
Hi Mukul, thanks a lot! 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";); > These were the lines that changed the game. Seems to work like a charm now :-) Happy Weekend, Felix > 2. Use the jaxp.SourceValidator sample, with -xsd11 flag > > > On Fri, Feb 19, 2010 at 9:02 PM, Felix Nensa 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: > > > > > > http://www.w3.org/2001/XMLSchema"; > >targetNamespace="http://www.zeec.de"; > >xmlns="http://www.zeec.de"; > >elementFormDefault="qualified"> > > > > > > > > > > maxOccurs="1" > > /> > > maxOccurs="1" > > /> > > maxOccurs="1" > > /> > > > maxOccurs="unbounded" /> > > > > > > > > > > > > > > > > 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 > > -- Felix Nensa CTO zeec GmbH Neusser Str. 28 50670 Cologne Germany mail: felix.ne...@zeec.biz phone: +49 221 37997 472 fax: +49 221 37997 450 mobile: +49 171 958 51 40 web: www.zeec.biz
Re: Schema 1.1 support
On Fri, Feb 19, 2010 at 9:38 PM, Michael Glavassevich wrote: >> 2. Use the jaxp.SourceValidator sample, with -xsd11 flag > > This isn't really a second method. It's just a sample demonstrating the > first. You're right, Michael :) -- Regards, Mukul Gandhi - To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org For additional commands, e-mail: j-users-h...@xerces.apache.org
Re: Schema 1.1 support
Mukul Gandhi 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 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: > > > > > > http://www.w3.org/2001/XMLSchema"; > > targetNamespace="http://www.zeec.de"; > > xmlns="http://www.zeec.de"; > > elementFormDefault="qualified"> > > > > > > > > > > > /> > > > /> > > > /> > > > maxOccurs="unbounded" /> > > > > > > > > > > > > > > > > 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
Re: Schema 1.1 support
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 On Fri, Feb 19, 2010 at 9:02 PM, Felix Nensa 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: > > > http://www.w3.org/2001/XMLSchema"; > targetNamespace="http://www.zeec.de"; > xmlns="http://www.zeec.de"; > elementFormDefault="qualified"> > > > > > /> > /> > /> > maxOccurs="unbounded" /> > > > > > > > > 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
Re: Schema 1.1 support
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: http://www.w3.org/2001/XMLSchema"; targetNamespace="http://www.zeec.de"; xmlns="http://www.zeec.de"; elementFormDefault="qualified"> Best regards, Felix 2010/2/13 Mukul Gandhi > Hi Felix, > The upcoming Xerces-J release, 2.10.0 would have a preview > implementation of XML Schema 1.1 and that would have this support. > > If you want, you may try compiling it from, > https://svn.apache.org/repos/asf/xerces/java/branches/xml-schema-1.1-dev/. > > On Sat, Feb 13, 2010 at 4:03 AM, Felix Nensa wrote: > > Hi folks, > > > > I am looking for an XML validator that supports Schema 1.1 or to be more > > precise just maxOccurs="unbounded" within elements. > > As I am using xerces-j for quite a while now it would be my first choice. > > Last week I checked out the head revision and compiled it but had no luck > > with my schema. > > Any hints would be great. Thanks in advance, > > > > 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 > >
Re: Schema 1.1 support
A more long winded explanation of the validation api: http://www.ibm.com/developerworks/xml/library/x-javaxmlvalidapi.html Michael Glavassevich wrote: If you want to try out the XML Schema 1.1 support it's accessible through the JAXP Validation API. Instead of "http://www.w3.org/2001/XMLSchema"; you specify "http://www.w3.org/XML/XMLSchema/v1.1"; as the schema language. For example: SchemaFactory sf = SchemaFactory.newInstance("http://www.w3.org/XML/XMLSchema/v1.1";); Schema s = sf.newSchema(...); For reference here's a list [1] of the XML Schema 1.1 features which have been implemented to date. Thanks. [1] http://markmail.org/message/7gryseh6sjvwv22h Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: mrgla...@ca.ibm.com E-mail: mrgla...@apache.org Mukul Gandhi wrote on 02/13/2010 01:01:01 AM: > Hi Felix, >The upcoming Xerces-J release, 2.10.0 would have a preview > implementation of XML Schema 1.1 and that would have this support. > > If you want, you may try compiling it from, > https://svn.apache.org/repos/asf/xerces/java/branches/xml-schema-1.1-dev/. > > On Sat, Feb 13, 2010 at 4:03 AM, Felix Nensa wrote: > > Hi folks, > > > > I am looking for an XML validator that supports Schema 1.1 or to be more > > precise just maxOccurs="unbounded" within elements. > > As I am using xerces-j for quite a while now it would be my first choice. > > Last week I checked out the head revision and compiled it but had no luck > > with my schema. > > Any hints would be great. Thanks in advance, > > > > 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 -- 0x2B | ~0x2b -- Hamlet - To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org For additional commands, e-mail: j-users-h...@xerces.apache.org
Re: Schema 1.1 support
Mukul Gandhi wrote on 02/13/2010 03:33:29 AM: > Here are the answers, to the questions you asked that I'm aware of: > > On Sat, Feb 13, 2010 at 12:50 PM, Olivier Rossel > wrote: > > - does substitutionGroup still require the newer definition to be a > > valid derivation of the original group? > > I don't think, this has changed. Please refer, > http://www.w3.org/TR/xmlschema11-1/#Element_Equivalence_Class which > says: > > All such members must have type definitions which are either the same > as the head's type definition or derived from it. > > > > - is it possible to substitute a namespaced element for a > > non-namespaced element? at the moment, in XSD 1.0, i could not mention > > a non-namespaced element from inside a namespaced schema. > > I don't think, this was disallowed in XSD 1.0 as well. Please refer, > http://www.w3.org/TR/xmlschema-1/#Declarations_Summary (section, > "2.2.2.2 Element Substitution Group") which says: > > Any top-level element declaration can serve as the defining member, or > head, for an element substitution group. Other top-level element > declarations, _regardless of target namespace_, can be designated as > members of the substitution group headed by this element. > He may have been thinking of unqualified local element declarations. You can only refer to globals. > > - will xs:redefine still exist in XSD 1.1? > xs:redefine still exists in XSD 1.1, but it's marked as a deprecated > feature in XSD 1.1. > > XSD 1.1 defines a new schema component, xs:override (which is > conceptually similar to xs:redefine), which allows unrestricted > re-definition of schema components from overridden schemas > (xs:redefine required the overriding schema, to have components, which > should have derivation relationship to the overridden components). FYI to folks. xs:override hasn't been implemented yet so don't expect to see this in Xerces-J 2.10.0. It's future work. > > will it be possible to > > chain schemas, and (for example) to override a definition at a given > > point of the chain, and then to redefine that definition at a later > > point of that chain? > > I don't know for sure, a right answer to this. But my feeling is, that > a chained specification of overridden components should be possible. > > I suggest, please ask "XML Schema" language questions on "W3C XML > Schema" mailing list (ref, xmlschema-...@w3.org). > > > -- > 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
Re: Schema 1.1 support
If you want to try out the XML Schema 1.1 support it's accessible through the JAXP Validation API. Instead of "http://www.w3.org/2001/XMLSchema"; you specify "http://www.w3.org/XML/XMLSchema/v1.1"; as the schema language. For example: SchemaFactory sf = SchemaFactory.newInstance ("http://www.w3.org/XML/XMLSchema/v1.1";); Schema s = sf.newSchema(...); For reference here's a list [1] of the XML Schema 1.1 features which have been implemented to date. Thanks. [1] http://markmail.org/message/7gryseh6sjvwv22h Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: mrgla...@ca.ibm.com E-mail: mrgla...@apache.org Mukul Gandhi wrote on 02/13/2010 01:01:01 AM: > Hi Felix, >The upcoming Xerces-J release, 2.10.0 would have a preview > implementation of XML Schema 1.1 and that would have this support. > > If you want, you may try compiling it from, > https://svn.apache.org/repos/asf/xerces/java/branches/xml-schema-1.1-dev/. > > On Sat, Feb 13, 2010 at 4:03 AM, Felix Nensa wrote: > > Hi folks, > > > > I am looking for an XML validator that supports Schema 1.1 or to be more > > precise just maxOccurs="unbounded" within elements. > > As I am using xerces-j for quite a while now it would be my first choice. > > Last week I checked out the head revision and compiled it but had no luck > > with my schema. > > Any hints would be great. Thanks in advance, > > > > 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
Re: Schema 1.1 support
Here are the answers, to the questions you asked that I'm aware of: On Sat, Feb 13, 2010 at 12:50 PM, Olivier Rossel wrote: > - does substitutionGroup still require the newer definition to be a > valid derivation of the original group? I don't think, this has changed. Please refer, http://www.w3.org/TR/xmlschema11-1/#Element_Equivalence_Class which says: All such members must have type definitions which are either the same as the head's type definition or derived from it. > - is it possible to substitute a namespaced element for a > non-namespaced element? at the moment, in XSD 1.0, i could not mention > a non-namespaced element from inside a namespaced schema. I don't think, this was disallowed in XSD 1.0 as well. Please refer, http://www.w3.org/TR/xmlschema-1/#Declarations_Summary (section, "2.2.2.2 Element Substitution Group") which says: Any top-level element declaration can serve as the defining member, or head, for an element substitution group. Other top-level element declarations, _regardless of target namespace_, can be designated as members of the substitution group headed by this element. > - will xs:redefine still exist in XSD 1.1? xs:redefine still exists in XSD 1.1, but it's marked as a deprecated feature in XSD 1.1. XSD 1.1 defines a new schema component, xs:override (which is conceptually similar to xs:redefine), which allows unrestricted re-definition of schema components from overridden schemas (xs:redefine required the overriding schema, to have components, which should have derivation relationship to the overridden components). > will it be possible to > chain schemas, and (for example) to override a definition at a given > point of the chain, and then to redefine that definition at a later > point of that chain? I don't know for sure, a right answer to this. But my feeling is, that a chained specification of overridden components should be possible. I suggest, please ask "XML Schema" language questions on "W3C XML Schema" mailing list (ref, xmlschema-...@w3.org). -- Regards, Mukul Gandhi - To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org For additional commands, e-mail: j-users-h...@xerces.apache.org
Re: Schema 1.1 support
some questions about XSD 1.1: - does substitutionGroup still require the newer definition to be a valid derivation of the original group? - is it possible to substitute a namespaced element for a non-namespaced element? at the moment, in XSD 1.0, i could not mention a non-namespaced element from inside a namespaced schema. - will xs:redefine still exist in XSD 1.1? will it be possible to chain schemas, and (for example) to override a definition at a given point of the chain, and then to redefine that definition at a later point of that chain? any info is very valuable for our project. thank you. On Sat, Feb 13, 2010 at 7:01 AM, Mukul Gandhi wrote: > Hi Felix, > The upcoming Xerces-J release, 2.10.0 would have a preview > implementation of XML Schema 1.1 and that would have this support. > > If you want, you may try compiling it from, > https://svn.apache.org/repos/asf/xerces/java/branches/xml-schema-1.1-dev/. > > On Sat, Feb 13, 2010 at 4:03 AM, Felix Nensa wrote: >> Hi folks, >> >> I am looking for an XML validator that supports Schema 1.1 or to be more >> precise just maxOccurs="unbounded" within elements. >> As I am using xerces-j for quite a while now it would be my first choice. >> Last week I checked out the head revision and compiled it but had no luck >> with my schema. >> Any hints would be great. Thanks in advance, >> >> 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 > > - To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org For additional commands, e-mail: j-users-h...@xerces.apache.org
Re: Schema 1.1 support
Hi Felix, The upcoming Xerces-J release, 2.10.0 would have a preview implementation of XML Schema 1.1 and that would have this support. If you want, you may try compiling it from, https://svn.apache.org/repos/asf/xerces/java/branches/xml-schema-1.1-dev/. On Sat, Feb 13, 2010 at 4:03 AM, Felix Nensa wrote: > Hi folks, > > I am looking for an XML validator that supports Schema 1.1 or to be more > precise just maxOccurs="unbounded" within elements. > As I am using xerces-j for quite a while now it would be my first choice. > Last week I checked out the head revision and compiled it but had no luck > with my schema. > Any hints would be great. Thanks in advance, > > 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