OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] converting XML Schema to DTD

[ Lists Home | Date Index | Thread Index ]


The DTD is just fine.
The instance document you present should validate with this DTD just fine, 
_IF_ you remove the two attributes on the 'personnel' element.

These attributes are not declared in your DTD.

If you don't want to remove them, you could manually add these attribute 
declarations to your DTD:
<!ATTLIST personnel
  xmlns:xsi CDATA #IMPLIED
  xsi:noNamespaceSchemaLocation CDATA #IMPLIED
>

There will never be a perfect translation between DTDs and XML Schemata, 
because namespace declarations (the "xmlns:xsl" attribute) are invisible to 
XML Schema, but must be declared in DTDs.

-Wayne Steele


>From: "Banerjee, Saurabh" <sabanerjee@answerthink.com>
>To: "'xml-dev@lists.xml.org'" <xml-dev@lists.xml.org>
>Subject: [xml-dev] converting XML Schema to DTD
>Date: Mon, 28 Jan 2002 14:21:06 -0500
>
>I need help in converting the following schema to DTD. The schema depicts a
>simple case of personnel element with fname and lname using xs:all. Pl. see
>below
>DTD generated by XML Spy does not seem to be correct.
>
>SCHEMA:
>
><?xml version="1.0" encoding="UTF-8"?>
><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
>elementFormDefault="qualified">
><xs:element name="fname" type="xs:string"/>
><xs:element name="lname" type="xs:string"/>
><xs:element name="personnel">
><xs:complexType>
><xs:all>
><xs:element ref="lname" minOccurs="0"/>
><xs:element ref="fname" minOccurs="0"/>
></xs:all>
></xs:complexType>
></xs:element>
></xs:schema>
>
>DTD generated by XML Spy:
>
><?xml version="1.0" encoding="UTF-8"?>
><!--DTD generated by XML Spy v4.2 U (http://www.xmlspy.com)-->
><!ELEMENT fname (#PCDATA)>
><!ELEMENT lname (#PCDATA)>
><!ELEMENT personnel (lname?, fname?)>
>
>
>this is not correct because the XML below is INVALID with the DTD but valid
>with the SCHEMA.
>
><?xml version="1.0" encoding="UTF-8"?>
><!--Sample XML file generated by XML Spy v4.2 U (http://www.xmlspy.com)-->
><personnel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>xsi:noNamespaceSchemaLocation="D:\dtd2xs\try.xsd">
>	<fname>String1</fname>
>	<lname>String2</lname>
></personnel>
>


_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS