[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Combining DTD and Schema declarations in the same XML

  • To: <xml-dev@l...>
  • Subject: Combining DTD and Schema declarations in the same XML
  • From: "Young Matthew" <matthew.young@f...>
  • Date: Wed, 9 Feb 2005 15:16:45 +0100
  • Thread-index: AcUOsfwkL3hsXdcfRFKL8tsmKzE5LQ==
  • Thread-topic: Combining DTD and Schema declarations in the same XML

combining dtd
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>

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.