[oXygen-user] Empty Schema Element

Christian Kosmowski
Fri Feb 20 06:30:43 CST 2009


Hi George,

That was the point. I forgot to set the type where the element is 
defined. now it works.

Thanks you!

George Cristian Bina schrieb:
> Hi Christian,
>
> Normally I would define an empty element setting it a type like
>
>     <xs:complexType name="Empty1">
>         <xs:sequence/>
>     </xs:complexType>
>
> In any case, if you put your simple type that also should work. What I 
> believe happens in your case is that you define an element without 
> setting its type, like in the case of the test element from the sample 
> below. There you find also two empty elements defined with your type 
> and with the above type.
>
> test.xsd
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
>     <xs:element name="root">
>         <xs:complexType>
>             <xs:choice maxOccurs="unbounded">
>                 <xs:element ref="empty1"/>
>                 <xs:element ref="empty2"/>
>                 <xs:element ref="test"/>
>             </xs:choice>
>         </xs:complexType>
>     </xs:element>
>
>     <xs:element name="empty1" type="Empty1"/>
>     <xs:element name="empty2" type="Empty2"/>
>     <xs:element name="test"/>
>
>     <xs:complexType name="Empty1">
>         <xs:sequence/>
>     </xs:complexType>
>
>     <xs:simpleType name="Empty2">
>         <xs:annotation>
>             <xs:documentation>
>                 Elemts of the type »Empty« must have no content.
>             </xs:documentation>
>         </xs:annotation>
>         <xs:restriction base="xs:string">
>             <xs:enumeration value=""/>
>         </xs:restriction>
>     </xs:simpleType>
>
> </xs:schema>
>
>
> test.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
> <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>  xsi:noNamespaceSchemaLocation="test.xsd">
>
>   <empty1/>
>   <empty2></empty2>
>   <test>
>     <empty1/>
>   </test>
> </root>
>
>
> Best Regards,
> George


-- 
QuinScape GmbH              
Wittekindstraße 30          Tel. : 0231 / 53 38 31 231
44139 Dortmund              Fax. : 0231 / 53 38 31 111
http://www.QuinScape.de
http://www.docscape.de

Geschäftsführer:
Thomas Biskup            Sitz Dortmund
Dr. Norbert Jesse        HRB 14740
Dr. Gero Presser         Amtsgericht Dortmund 




More information about the oXygen-user mailing list