Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Example of combine XML Schema and DTDs?

From: photinia@-------------.---
To: xmlschema-dev@--.---
Date: 11/22/2005 6:57:00 AM
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
processor
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
(horse.xml):

--------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<pets xmlns="http://tempuri.org/horse2.xsd">
    <horse	name="lightening"
			weight="1300"
			birthDate="June 14, 2003">
    </horse>
    <familyHistory>horseFamilyHistory.txt</familyHistory>
    <photo>myHorse.jpg</photo>
</pets>
-----------------------------------------------------------------------------

I can use Visual Studio to automatically generate the following XSD
schema
(horse.xsd):

-----------------------------------------------------------------------------
<?xml version="1.0"?>
<xs:schema id="NewDataSet"
targetNamespace="http://tempuri.org/horse2.xsd"
xmlns:mstns="http://tempuri.org/horse2.xsd"
xmlns="http://tempuri.org/horse2.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
attributeFormDefault="qualified" elementFormDefault="qualified">
  <xs:element name="pets">
    <xs:complexType>
      <xs:sequence>
        <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:complexType>
            <xs:attribute name="name" form="unqualified"
type="xs:string" />
            <xs:attribute name="weight" form="unqualified"
type="xs:string" />
            <xs:attribute name="birthDate" form="unqualified"
type="xs:string"
/>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="NewDataSet" msdata:IsDataSet="true"
msdata:EnforceConstraints="False">
    <xs:complexType>
      <xs:choice maxOccurs="unbounded">
        <xs:element ref="pets" />
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>
-------------------------------------------------------------------------------

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.
Bill




From george@o... Wed Nov 23 01:22:27 2005
Received: from aji.w3.org ([133.27.228.225] helo=aji.w3.mag.keio.ac.jp)
	by frink.w3.org


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent