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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Combining DTD and Schema declarations in the same XML

[ Lists Home | Date Index | Thread Index ]
  • To: <xml-dev@lists.xml.org>
  • Subject: Combining DTD and Schema declarations in the same XML
  • From: "Young Matthew" <matthew.young@forsakringskassan.se>
  • Date: Wed, 9 Feb 2005 15:16:45 +0100
  • Thread-index: AcUOsfwkL3hsXdcfRFKL8tsmKzE5LQ==
  • Thread-topic: Combining DTD and Schema declarations in the same XML

Hej,

Want to combine DTD/Schema declaration in the same XML document.  We
have legacy DTD documents which I would like to reuse with
"under-development" XML Schemas and take advantage of namespace support
with schemas.  See example documents below.

If I validate the XML below no validation error is thrown as excepted
since the part1 element should only occur once (eg. maxOccurs="1").
Plus the part2 element is never asked for the DTD.

Would greatly appreciated references to articles or any ideas?  Thanks a
mil / Matthew Young



(XML)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE main PUBLIC "DTD" "C:\DOCUME~1\40042466\dtd\mixing.dtd" []>
<main name="test">
	<part1 xmlns="http://rfv.sfa.se";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://rfv.sfa.se
C:\DOCUME~1\40042466\xsd\mixing.xsd" name="mypart"></part1>
	<part1 name=""></part1>
</main>


(DTD)
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT main (part1, part2)>
<!ATTLIST main
        name CDATA #REQUIRED>


(XSL)
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://rfv.sfa.se"; targetNamespace="http://rfv.sfa.se";
xmlns:xs="http://www.w3.org/2001/XMLSchema";
elementFormDefault="qualified">
	<xs:element name="main">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="part1" minOccurs="0"
maxOccurs="1"/>
				<xs:element ref="part2" minOccurs="0"/>
			</xs:sequence>
			<xs:attribute name="name" use="required"
type="xs:string"/>
		</xs:complexType>
	</xs:element>
	<xs:element name="part1">
		<xs:complexType>
			<xs:attribute name="name" use="required"
type="xs:string"/>
		</xs:complexType>
	</xs:element>
	<xs:element name="part2">
		<xs:complexType>
			<xs:attribute name="name" use="required"
type="xs:string"/>
		</xs:complexType>
	</xs:element>
</xs:schema>




 

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

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