A
AlexS
Hello,
I took example of subsitutionGroup definition from 3.3.2 at
http://www.w3.org/TR/xmlschema-1/#cElement_Declarations.
Test file I use is:
<xs:schema targetNamespace="schema" xmlns:x="schema"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="facet">
<xs:complexContent>
<xs:extension base="xs:annotated">
<xs:attribute name="value" use="required"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="facet" type="xs:facet" abstract="true"/>
<xs:element name="encoding" substitutionGroup="xs:facet">
<xs:complexType>
<xs:complexContent>
<xs:restriction base="xs:facet">
<xs:sequence>
<xs:element ref="annotation" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="value" type="xs:encodings"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="period" substitutionGroup="xs:facet">
<xs:complexType>
<xs:complexContent>
<xs:restriction base="xs:facet">
<xs:sequence>
<xs:element ref="annotation" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="value" type="xs:duration"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:complexType name="datatype">
<xs:sequence>
<xs:element ref="facet" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="name" type="xs:NCName" use="optional"/>
</xs:complexType>
</xs:schema>
..Net ReadXMLSchema or XmlSchema.Compile fails with:
System.Xml.Schema.XmlSchemaException: Reference to undeclared substitution
group
affiliation. An error occurred at , (13, 3).
Schema compile error:
System.Exception: Schema error ---> System.Xml.Schema.XmlSchemaException:
Refere
nce to undeclared substitution group affiliation. An error occurred at ,
(13, 3)
..
--- End of inner exception stack trace ---
at XBRLMainClass.SchemaErrorHandler(Object sender, ValidationEventArgs
vea) i
n c:\...\Main.cs:line 88
at System.Xml.Schema.Compiler.SendValidationEvent(XmlSchemaException e,
XmlSe
verityType severity)
at
System.Xml.Schema.Compiler.CompileSubstitutionGroup(XmlSchemaSubstitutionG
roup substitutionGroup)
at System.Xml.Schema.Compiler.CompileTo(SchemaInfo schemaInfo)
at System.Xml.Schema.XmlSchema.Compile(XmlSchemaCollection collection,
XmlNam
eTable nameTable, SchemaNames schemaNames, ValidationEventHandler
validationEven
tHandler, String targetNamespace, SchemaInfo schemaInfo, Boolean
compileContentM
odel, XmlResolver resolver)
at System.Xml.Schema.XmlSchema.Compile(ValidationEventHandler
validationEvent
Handler).
And validator at
http://apps.gotdotnet.com/xmltools/xsdvalidator/Default.aspx fails in
different way:
Reference to undeclared substitution group affiliation. An error occurred at
, (13, 3).
Undefined complexType 'http://www.w3.org/2001/XMLSchema:annotated' is used
as a base for complex type extension". An error occurred at , (5, 5).
Type 'http://www.w3.org/2001/XMLSchema:facet' is not declared. An error
occurred at , (11, 3).
Undefined complexType 'http://www.w3.org/2001/XMLSchema:facet' is used as a
base for complex type restriction". An error occurred at , (16, 6).
Undefined complexType 'http://www.w3.org/2001/XMLSchema:facet' is used as a
base for complex type restriction". An error occurred at , (29, 6).
The 'facet' element is not declared. An error occurred at , (41, 5).
What's the problem?
Is the sample in w3.org docs wrong? Who is right, .Net validator, gotdotnet
validator or w3.org?
Can anybody point in right direction? Or provide a sample of xsd file with
substitution groups working with .Net validation?
Thanks!
I took example of subsitutionGroup definition from 3.3.2 at
http://www.w3.org/TR/xmlschema-1/#cElement_Declarations.
Test file I use is:
<xs:schema targetNamespace="schema" xmlns:x="schema"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="facet">
<xs:complexContent>
<xs:extension base="xs:annotated">
<xs:attribute name="value" use="required"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="facet" type="xs:facet" abstract="true"/>
<xs:element name="encoding" substitutionGroup="xs:facet">
<xs:complexType>
<xs:complexContent>
<xs:restriction base="xs:facet">
<xs:sequence>
<xs:element ref="annotation" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="value" type="xs:encodings"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="period" substitutionGroup="xs:facet">
<xs:complexType>
<xs:complexContent>
<xs:restriction base="xs:facet">
<xs:sequence>
<xs:element ref="annotation" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="value" type="xs:duration"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:complexType name="datatype">
<xs:sequence>
<xs:element ref="facet" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="name" type="xs:NCName" use="optional"/>
</xs:complexType>
</xs:schema>
..Net ReadXMLSchema or XmlSchema.Compile fails with:
System.Xml.Schema.XmlSchemaException: Reference to undeclared substitution
group
affiliation. An error occurred at , (13, 3).
Schema compile error:
System.Exception: Schema error ---> System.Xml.Schema.XmlSchemaException:
Refere
nce to undeclared substitution group affiliation. An error occurred at ,
(13, 3)
..
--- End of inner exception stack trace ---
at XBRLMainClass.SchemaErrorHandler(Object sender, ValidationEventArgs
vea) i
n c:\...\Main.cs:line 88
at System.Xml.Schema.Compiler.SendValidationEvent(XmlSchemaException e,
XmlSe
verityType severity)
at
System.Xml.Schema.Compiler.CompileSubstitutionGroup(XmlSchemaSubstitutionG
roup substitutionGroup)
at System.Xml.Schema.Compiler.CompileTo(SchemaInfo schemaInfo)
at System.Xml.Schema.XmlSchema.Compile(XmlSchemaCollection collection,
XmlNam
eTable nameTable, SchemaNames schemaNames, ValidationEventHandler
validationEven
tHandler, String targetNamespace, SchemaInfo schemaInfo, Boolean
compileContentM
odel, XmlResolver resolver)
at System.Xml.Schema.XmlSchema.Compile(ValidationEventHandler
validationEvent
Handler).
And validator at
http://apps.gotdotnet.com/xmltools/xsdvalidator/Default.aspx fails in
different way:
Reference to undeclared substitution group affiliation. An error occurred at
, (13, 3).
Undefined complexType 'http://www.w3.org/2001/XMLSchema:annotated' is used
as a base for complex type extension". An error occurred at , (5, 5).
Type 'http://www.w3.org/2001/XMLSchema:facet' is not declared. An error
occurred at , (11, 3).
Undefined complexType 'http://www.w3.org/2001/XMLSchema:facet' is used as a
base for complex type restriction". An error occurred at , (16, 6).
Undefined complexType 'http://www.w3.org/2001/XMLSchema:facet' is used as a
base for complex type restriction". An error occurred at , (29, 6).
The 'facet' element is not declared. An error occurred at , (41, 5).
What's the problem?
Is the sample in w3.org docs wrong? Who is right, .Net validator, gotdotnet
validator or w3.org?
Can anybody point in right direction? Or provide a sample of xsd file with
substitution groups working with .Net validation?
Thanks!