W3C home > Mailing lists > Public > xmlschema-dev@w3.org > November 2005

Example of combine XML Schema and DTDs?

From: <photinia@freediscovery.com>
Date: Tue, 22 Nov 2005 14:56:38 -0800
Message-ID: <20051122145638.vh92h9v8em40ss8s@www.freediscovery.com>
To: xmlschema-dev@w3.org
Cc: bishop@freediscovery.com

I noticed that the item "Can I combine XML Schema and DTDs?" of
"XML Schema FAQ" (http://www.schemavalid.com/faq/xml-schema.html#a)
cited Prof. Thompson statement:
"[Henry Thompson] DTD processing and XML Schema processing are
completely independent, hence combinable: just make sure your schema
includes a validating XML parser as its first stage."

I am relatively new in XML and not sure how I can make it work in
Microsoft Visual Studio .NET 2003. For example, if there is a XML file
like this

<?xml version="1.0" encoding="utf-8"?>
<pets xmlns="http://tempuri.org/horse2.xsd">
    <horse	name="lightening"
			birthDate="June 14, 2003">

I can use Visual Studio to automatically generate the following XSD

<?xml version="1.0"?>
<xs:schema id="NewDataSet"
attributeFormDefault="qualified" elementFormDefault="qualified">
  <xs:element name="pets">
        <xs:element name="familyHistory" type="xs:string" minOccurs="0"
        <xs:element name="photo" type="xs:string" minOccurs="0" />
        <xs:element name="horse" minOccurs="0" maxOccurs="unbounded">
            <xs:attribute name="name" form="unqualified"
type="xs:string" />
            <xs:attribute name="weight" form="unqualified"
type="xs:string" />
            <xs:attribute name="birthDate" form="unqualified"
  <xs:element name="NewDataSet" msdata:IsDataSet="true"
      <xs:choice maxOccurs="unbounded">
        <xs:element ref="pets" />

Then, I can modify horse.xsd to set weight's type decimal, etc.

However, since myHorse.jpg is unparsed (non-XML) data, it seems that
it can be best represented using DTD's unparsed external entities.
Also, horseFamilyHistory.txt is a big, external, ACSII file.

Question 1: Currently, is it possible to handle both myHorse.jpg and
horseFamilyHistory.txt using "pure" XSD schema?

Question 2: If yes, how to do it?

Question 3: If not, how to combine the XSD schema with DTD?

Question 4: How to perform XML validation of the above (modified) XML
using, say, C# within Microsoft Visual Studio .NET?

Your kind help would be greatly appreciated.
Received on Wednesday, 23 November 2005 01:07:53 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:09 UTC