[
Lists Home |
Date Index |
Thread Index
]
- To: <wagi_ch@gmx.net>, <xml-dev@lists.xml.org>
- Subject: RE: [xml-dev] Inconsistent behaviour, obviously correct schema doesn't work anymore
- From: "Ivan Pedruzzi" <ipedruzz@progress.com>
- Date: Fri, 29 Oct 2004 18:27:01 -0400
- Thread-index: AcS95U4PPt3vifkzTg6vve5Qs/H15gAExNBw
- Thread-topic: [xml-dev] Inconsistent behaviour, obviously correct schema doesn't work anymore
I don't think the following definition is correct: you cannot define an
anonymous SimpleType and use the type attribute at the same time.
<xs:attribute name="alignment" type="xs:NMTOKEN" default="left">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="left"/>
<xs:enumeration value="center"/>
<xs:enumeration value="right"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
Validating Untitled2.xml...
file:///c:/Temp/Untitled1.xsd:12,72: Attribute declarations may not
contain both a type and a simpleType declaration
After removing the type attribute
Xerces-J and XSV 2.7 pass, but Xerces-C, MSXML and .NET do not.
If you add mixed="true" to the "paraType" definition like that they all
pass
<xs:complexType name="paraType" mixed="true">
Ivan
> -----Original Message-----
> From: wagi_ch@gmx.net [mailto:wagi_ch@gmx.net]
> Sent: Friday, October 29, 2004 2:26 PM
> To: xml-dev@lists.xml.org
> Subject: [xml-dev] Inconsistent behaviour, obviously correct schema
doesn't work anymore
>
> Hi
> First time using any mailing list, so i hope everythings correct...
>
> I have the following problem: i let xmlspy generate a schema from a
> sample-xml file with all the elements i need and then manually
modified it.
> it worked great until i had to reinstall xmlspy, now the files won't
> validate with the very same schema!? if anyone can discover the error
in the
> schema i'd be very happy because, to me, everything looks quite ok.
> (the <list> element is causing the error, xmlspy says "element 'list'
is
> undefined", the same happens with all the elements defined in
> "DocumentElementsType")
>
> schema:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema elementFormDefault="qualified"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <!-- Beginn Typdefinition Inhaltselemente -->
> <xs:complexType name="DocumentElementsType" mixed="true">
> <xs:choice minOccurs="0" maxOccurs="unbounded">
> <!-- Dropdown-Steuerelemente -->
> <xs:element name="dropdown">
> <xs:complexType>
> <xs:simpleContent>
> <xs:extension
base="xs:string">
> <xs:attribute
name="alignment" type="xs:NMTOKEN"
> default="left">
>
<xs:simpleType>
>
<xs:restriction base="xs:NMTOKEN">
>
<xs:enumeration value="left"/>
>
<xs:enumeration value="center"/>
>
<xs:enumeration value="right"/>
>
</xs:restriction>
>
</xs:simpleType>
> </xs:attribute>
> </xs:extension>
> </xs:simpleContent>
> </xs:complexType>
> </xs:element>
> <!-- Zitate -->
> <xs:element name="quote"/>
> <!-- Listen -->
> <xs:element name="list">
> <xs:complexType>
> <xs:sequence>
> <xs:element
name="listitem" type="DocumentElementsType"
> maxOccurs="unbounded"/>
> </xs:sequence>
> <xs:attribute name="type"
use="optional" default="unordered">
> <xs:simpleType>
> <xs:restriction
base="xs:NMTOKEN">
>
<xs:enumeration value="ordered"/>
>
<xs:enumeration value="unordered"/>
>
</xs:restriction>
> </xs:simpleType>
> </xs:attribute>
> </xs:complexType>
> </xs:element>
> <!-- Tabelle -->
> <xs:element name="table">
> <xs:complexType>
> <xs:sequence>
> <xs:element
name="header">
> <xs:complexType>
>
<xs:sequence>
>
<xs:element name="column"
> type="DocumentElementsType"
> maxOccurs="unbounded"/>
>
</xs:sequence>
>
</xs:complexType>
> </xs:element>
> <xs:element name="row"
maxOccurs="unbounded">
> <xs:complexType>
>
<xs:sequence>
>
<xs:element name="column"
> type="DocumentElementsType"
> maxOccurs="unbounded"/>
>
</xs:sequence>
>
</xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <!-- Bilder -->
> <xs:element name="image">
> <xs:complexType>
> <xs:simpleContent>
> <xs:extension
base="xs:string">
> <xs:attribute
name="src" type="xs:string" use="required"/>
> <xs:attribute
name="description" type="xs:string"
> use="required"/>
> <xs:attribute
name="border" type="xs:string"
> use="optional"/>
> <xs:attribute
name="margin" type="xs:string"
> use="optional"/>
> <xs:attribute
name="position" type="xs:NMTOKEN"
> use="optional"
> default="left"/>
> </xs:extension>
> </xs:simpleContent>
> </xs:complexType>
> </xs:element>
> <!-- Links -->
> <xs:element name="link" type="linkType"/>
> </xs:choice>
> </xs:complexType>
> <!-- Ende Typdefinition Inhaltselemente -->
> <!-- Beginn Typdefinition Paragraphinhalt (separiert wg.
Attribut "title")
> -->
> <xs:complexType name="paraType">
> <xs:complexContent>
> <xs:extension base="DocumentElementsType">
> <xs:attribute name="title"
type="xs:string" use="required"/>
> </xs:extension>
> </xs:complexContent>
> </xs:complexType>
> <!-- Ende Typdefinition Paragraphinhalt -->
> <!-- Beginn Typdefinition Link -->
> <xs:complexType name="linkType">
> <xs:simpleContent>
> <xs:extension base="xs:string">
> <xs:attribute name="href"
type="xs:anyURI" use="required"/>
> <xs:attribute name="destination"
use="required">
> <xs:simpleType>
> <xs:restriction
base="xs:NMTOKEN">
> <xs:enumeration
value="inbound"/>
> <xs:enumeration
value="outbound"/>
> </xs:restriction>
> </xs:simpleType>
> </xs:attribute>
> <xs:attribute name="target"
use="optional">
> <xs:simpleType>
> <xs:restriction
base="xs:NMTOKEN">
> <xs:enumeration
value="this"/>
> <xs:enumeration
value="new"/>
> <xs:enumeration
value="popup"/>
> </xs:restriction>
> </xs:simpleType>
> </xs:attribute>
> <xs:attribute name="desttype"
use="optional" default="html">
> <xs:simpleType>
> <xs:restriction
base="xs:string">
> <xs:enumeration
value="html"/>
> <xs:enumeration
value="pdf"/>
> <xs:enumeration
value="jpeg"/>
> <xs:enumeration
value="gif"/>
> </xs:restriction>
> </xs:simpleType>
> </xs:attribute>
> </xs:extension>
> </xs:simpleContent>
> </xs:complexType>
> <!-- Ende Typdefinition Link -->
> <!-- Dokument -->
> <xs:element name="document">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="meta">
> <xs:complexType>
> <xs:sequence>
> <xs:element
name="title" type="xs:string"/>
> <xs:element
name="abstract" type="xs:string"/>
> <xs:element
name="date" type="xs:string"/>
> <xs:element
name="keyword" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <xs:element name="body">
> <xs:complexType>
> <xs:sequence>
> <xs:element
name="picture">
>
<xs:complexType>
>
<xs:attribute name="src" type="xs:string"
> use="required"/>
>
</xs:complexType>
> </xs:element>
> <xs:element
name="heading" type="xs:string"/>
> <xs:choice>
>
<xs:element name="para" type="paraType"
> maxOccurs="unbounded"/>
>
<xs:element name="customdata">
>
<xs:complexType>
>
<xs:simpleContent>
>
<xs:extension base="xs:string">
>
<xs:attribute name="data"
> type="xs:string" use="required"/>
>
<xs:attribute name="schema"
> type="xs:string" use="required"/>
>
<xs:attribute name="template"
> type="xs:string" use="required"/>
>
</xs:extension>
>
</xs:simpleContent>
>
</xs:complexType>
>
</xs:element>
> </xs:choice>
> <xs:element
name="links" minOccurs="0">
>
<xs:complexType>
>
<xs:sequence>
>
<xs:element name="link" type="linkType"
> maxOccurs="unbounded"/>
>
</xs:sequence>
>
</xs:complexType>
> </xs:element>
> <xs:element
name="script" minOccurs="0"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema>
>
> xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <document>
> <meta>
> <title/>
> <abstract/>
> <date/>
> <keyword/>
> </meta>
> <body>
> <picture src="bannerimage://asdf.jpg"/>
> <heading>someheading</heading>
> <para title="asdf">text</para>
> <para title="hgl">text</para>
> <para title="dgh">text
> <list type="unordered">
> <listitem>text</listitem>
> <listitem>text</listitem>
> <listitem>text</listitem>
> </list>
> </para>
> </body>
> </document>
>
>
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
>
> The list archives are at http://lists.xml.org/archives/xml-dev/
>
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://www.oasis-open.org/mlmanage/index.php>
>
|