probleme mit schema-erzeugung
Frank (no reg)
- xml
Hi, hallo ...
irgendwie ist bei mir gerade der Wurm drin. Ich versuche eine XSD für eigene Zwecke (speziell lernen) zu bauen und habe immer wieder das Problem, dass entweder das Schema selbst nicht valide ist oder mein XML Dokument.
Ich erhalte immer denselben Fehler:
» F:\Projects\FlexReporting\Interface.FlexReporting.Common\RDL.xml » (16): The element 'http://tempuri.org/RDLSchema.xsd:formatclass' » has invalid child Element 'http://tempuri.org/RDLSchema.xsd:positionx'. » An error occurred at , (16, 5).
Sieht jemand von euch den Fehler? Danke schonmal im Voraus. :-) Frank
=================
16, 5 ist die Stelle im XML: <positionx ...> (ganzes XML hier folgt)
<?xml version="1.0" encoding="utf-8" ?> <report xmlns="http://tempuri.org/RDLSchema.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tempuri.org/RDLSchema.xsd RDLSchema.xsd"> <formats> <formatclass id="0001"> <font> <fontfamily>Arial</fontfamily> <fontstyles> <bold enabled="false" /> <italic enabled="false" /> <strikethrough enabled="false" /> <underline enabled="false" /> </fontstyles> <fontsize unit="px">12</fontsize> </font> <positionx type="absolute" unit="px">0</positionx> <positiony type="absolute" unit="px">0</positiony> <backcolor colorspace="rgb">ffffff</backcolor> <forecolor colorspace="rgb">000000</forecolor> <height unit="px">300</height> <width unit="px">500</width> </formatclass> </formats> <header formatref="00001"> <formatclass id="00002" cn="myClass"><backcolor colorspace="rgb">#ffffff</backcolor></formatclass> </header> <body></body> <footer></footer> </report>
================================================================== === nachfolgend das XSD
<?xml version="1.0" encoding="utf-8" ?> <xs:schema id="RDLSchema" targetNamespace="http://tempuri.org/RDLSchema.xsd" elementFormDefault="qualified" xmlns="http://tempuri.org/RDLSchema.xsd" xmlns:mstns="http://tempuri.org/RDLSchema.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:simpleType name="stype_25wordchars_notempty"> <xs:restriction base="xs:string"> <xs:pattern value="([a-zA-Z0-9_ ])+" /> <xs:minLength value="1" /> <xs:maxLength value="25" /> <xs:whiteSpace value="replace" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="stype_guid"> <xs:restriction base="xs:string"> <xs:pattern value="([a-zA-Z0-9]){8}-([a-zA-Z0-9]){4}-([a-zA-Z0-9]){4}-([a-zA-Z0-9]){4}-([a-zA-Z0-9]){12}" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="stype_unitstring"> <xs:restriction base="xs:string"> <xs:length value="2" /> <xs:pattern value="[a-z][a-z]" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="stype_formatting_positiontype"> <xs:restriction base="xs:string"> <xs:enumeration value="relative" /> <xs:enumeration value="absolute" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="stype_formatclassref"> <xs:restriction base="xs:string"> <xs:pattern value="([0-9])*" /> <xs:minLength value="1" /> <xs:maxLength value="12" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="stype_colorvaluergb"> <xs:restriction base="xs:string"> <xs:pattern value="(#[a-fA-F0-9]{6})|([a-fA-F0-9]{6})" /> <xs:maxLength value="7" /> </xs:restriction> </xs:simpleType> <!-- ======================================= --> <xs:complexType name="ctype_colorelement"> xs:simpleContent <xs:extension base="stype_colorvaluergb"> <xs:attribute name="colorspace" type="xs:string" fixed="rgb" /> </xs:extension> </xs:simpleContent> </xs:complexType> <xs:complexType name="ctype_formatting_size"> xs:simpleContent <xs:extension base="xs:int"> <xs:attribute name="unit" type="stype_unitstring" use="required" fixed="px" /> </xs:extension> </xs:simpleContent> </xs:complexType> <xs:complexType name="ctype_formatting_position"> xs:simpleContent <xs:extension base="xs:integer"> <xs:attribute name="type" type="stype_formatting_positiontype" default="absolute" /> <xs:attribute name="unit" type="stype_unitstring" default="px" /> </xs:extension> </xs:simpleContent> </xs:complexType> <xs:complexType name="ctype_enabled"> <xs:attribute name="enabled" type="xs:boolean" default="true" /> </xs:complexType> <xs:complexType name="ctype_fontstyles"> xs:all <xs:element name="italic" type="ctype_enabled" maxOccurs="1" /> <xs:element name="strikethrough" type="ctype_enabled" maxOccurs="1" /> <xs:element name="underline" type="ctype_enabled" maxOccurs="1" /> <xs:element name="bold" type="ctype_enabled" maxOccurs="1" /> </xs:all> </xs:complexType> <xs:complexType name="ctype_font"> <xs:all minOccurs="1" maxOccurs="1"> <xs:element name="fontfamily" type="stype_25wordchars_notempty" /> <xs:element name="fontsize" type="ctype_formatting_size" /> <xs:element name="fontstyles" type="ctype_fontstyles" /> </xs:all> </xs:complexType> <xs:complexType name="ctype_formatting_object" mixed="true"> xs:choice <xs:element name="positionx" type="ctype_formatting_position" /> <xs:element name="positiony" type="ctype_formatting_position" /> <xs:element name="height" type="ctype_formatting_size" /> <xs:element name="width" type="ctype_formatting_size" maxOccurs="1" /> <xs:element name="font" type="ctype_font" maxOccurs="1" /> <xs:element name="forecolor" type="ctype_colorelement" maxOccurs="1" /> <xs:element name="backcolor" type="ctype_colorelement" maxOccurs="1" /> </xs:choice> <xs:attribute name="id" type="stype_formatclassref" use="required" /> <xs:attribute name="cn" type="stype_25wordchars_notempty" use="optional" /> </xs:complexType> <!-- ============================================ --> <xs:complexType name="dtype_formatting_section"> xs:sequence <xs:element name="formatclass" type="ctype_formatting_object" /> </xs:sequence> </xs:complexType> <xs:complexType name="dtype_headerarea"> xs:choice <xs:element name="formatclass" type="ctype_formatting_object" maxOccurs="1" minOccurs="0" /> </xs:choice> <xs:attribute name="formatref" type="stype_formatclassref" use="optional" /> </xs:complexType> <xs:complexType name="dtype_body"> xs:choice <xs:element name="formatclass" type="ctype_formatting_object" maxOccurs="1" minOccurs="0" /> </xs:choice> <xs:attribute name="formatref" type="stype_formatclassref" use="optional" /> </xs:complexType> <xs:complexType name="dtype_footer"> xs:choice <xs:element name="formatclass" type="ctype_formatting_object" maxOccurs="1" minOccurs="0" /> </xs:choice> <xs:attribute name="formatref" type="stype_formatclassref" use="optional" /> </xs:complexType> <xs:complexType name="dtype_data"></xs:complexType> <!-- ========================================== --> <xs:element name="report"> xs:complexType xs:choice <xs:element name="formats" type="dtype_formatting_section" minOccurs="0" maxOccurs="1" /> <xs:element name="header" type="dtype_headerarea" minOccurs="1" maxOccurs="1" /> <xs:element name="body" type="dtype_body" minOccurs="1" maxOccurs="1" /> <xs:element name="footer" type="dtype_footer" minOccurs="1" maxOccurs="1" /> <xs:element name="data" type="dtype_data" minOccurs="0" maxOccurs="unbounded" /> </xs:choice> </xs:complexType> </xs:element> <!-- end of schema definition --> </xs:schema>
hat sich von selbst erledigt .. :-)
es lag an der Fehlinterpretation von xs:choice ...
FF