From DTD to XSD (Document Type Definition to XML Schema) -


i have dtd:

<!doctype [   <!element (b?, c*, (d|e)+)>   <!element b (#pcdata)>   <!element c (#pcdata)>   <!element d (#pcdata)>   <!element e empty>   <!attlist c attr cdata #implied> ]> 

i want convert (manually not program) xml schema, don't understand how create attribute c element.

here's how in xsd declare c has string content , attribute named attr:

        <xs:element name="c" minoccurs="0" maxoccurs="unbounded">           <xs:complextype>             <xs:simplecontent>               <xs:extension base="xs:string">                 <xs:attribute name="attr" type="xs:string"/>               </xs:extension>             </xs:simplecontent>           </xs:complextype> 

xsd

here's entire dtd written xsd:

<?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema">   <xs:element name="a">     <xs:complextype>       <xs:sequence>         <xs:element name="b" minoccurs="0" type="xs:string"/>         <xs:element name="c" minoccurs="0" maxoccurs="unbounded">           <xs:complextype>             <xs:simplecontent>               <xs:extension base="xs:string">                 <xs:attribute name="attr" type="xs:string"/>               </xs:extension>             </xs:simplecontent>           </xs:complextype>         </xs:element>         <xs:choice maxoccurs="unbounded">           <xs:element name="d" type="xs:string"/>           <xs:element name="e">             <xs:complextype/>           </xs:element>         </xs:choice>               </xs:sequence>     </xs:complextype>   </xs:element> </xs:schema> 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -