What's wrong in this schema?
This should cover W3C XML Schema, Relax NG and DTD related problems.
-
- Posts: 2
- Joined: Thu Dec 13, 2007 1:30 pm
What's wrong in this schema?
Good morning:
I'm trying to use JAXB and i have written the following schema:
I'm trying to use JAXB and i have written the following schema:
when i validate my schema i receive the following error:
<xsd:complexType name="MetaInformation"> <xsd:sequence> <xsd:element name="description" type="xsd:string" default=""/> <xsd:element name="keyword" type="xsd:string" maxOccurs="unbounded" minOccurs="0" default="" /> </xsd:sequence> </xsd:complexType> <xsd:complexType name = "xmldisplaydefinition"> <xsd:attribute name="identifier" type="xsd:string"/> <xsd:attribute name="kindOfDisplay" type="xsd:string"/> <xsd:sequence> <xsd:element name="metaInformation" type="MetaInformation" maxOccurs="1" minOccurs="0"/> </xsd:sequence> </xsd:complexType>
Invalid per cvc-complex-type.1.2.4: element {http://www.w3.org/2001/XMLSchema}:sequence not allowed here (5) in element {http://www.w3.org/2001/XMLSchema}:complexType, expecting
[{http://www.w3.org/2001/XMLSchema}:anyAt ... ibuteGroup]
-
- Posts: 2
- Joined: Thu Dec 13, 2007 1:30 pm
Sorry for the bad formatting
<xsd:complexType name="MetaInformation"> <xsd:sequence> <xsd:element name="description" type="xsd:string" default=""/> <xsd:element name="keyword" type="xsd:string" maxOccurs="unbounded" minOccurs="0" default="" /> </xsd:sequence> </xsd:complexType> <xsd:complexType name = "xmldisplaydefinition"> <xsd:attribute name="identifier" type="xsd:string"/> <xsd:attribute name="kindOfDisplay" type="xsd:string"/> <xsd:sequence> <xsd:element name="metaInformation" type="MetaInformation" maxOccurs="1" minOccurs="0"/> </xsd:sequence> </xsd:complexType>
<xsd:complexType name="MetaInformation"> <xsd:sequence> <xsd:element name="description" type="xsd:string" default=""/> <xsd:element name="keyword" type="xsd:string" maxOccurs="unbounded" minOccurs="0" default="" /> </xsd:sequence> </xsd:complexType> <xsd:complexType name = "xmldisplaydefinition"> <xsd:attribute name="identifier" type="xsd:string"/> <xsd:attribute name="kindOfDisplay" type="xsd:string"/> <xsd:sequence> <xsd:element name="metaInformation" type="MetaInformation" maxOccurs="1" minOccurs="0"/> </xsd:sequence> </xsd:complexType>
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Hi
The error message occurs because the 'xsd:sequence' element must be declared before declaring any attributes in the complex type. The correct schema should look like this :
Best regards,
Radu
The error message occurs because the 'xsd:sequence' element must be declared before declaring any attributes in the complex type. The correct schema should look like this :
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:complexType name="MetaInformation">
<xsd:sequence>
<xsd:element name="description" type="xsd:string" default=""/>
<xsd:element name="keyword" type="xsd:string" maxOccurs="unbounded" minOccurs="0"
default=""/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="xmldisplaydefinition">
<xsd:sequence>
<xsd:element name="metaInformation" type="MetaInformation" maxOccurs="1" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="identifier" type="xsd:string"/>
<xsd:attribute name="kindOfDisplay" type="xsd:string"/>
</xsd:complexType>
</xsd:schema>
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service