Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 xsd schema problem with XML

Author  Topic 

mixedupone3
Starting Member

8 Posts

Posted - 2002-05-16 : 15:40:15
I am new to XML.
Trying to get an XSD schema to work with SQL 2000. Just a basic .xml file with a simple query. I can get the xml to return the data using an XDR schema. I have the Virtual directories set up on IIS and I'm using SQL server 2000 on Advanced server 2000.

xsd schema:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema id="Root" xmlns=""
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:sql="urn:schemas-microsoft-com:mapping-schema" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="A_location">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="loc_ID" type="xsd:integer"/>
<xsd:element name="location">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="100"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
---------------------------------------------------------------
xml:

<ROOT xmlns:sql="urn:schemas-microsoft-com:xml-sql">
<sql:xpath-query mapping-schema="../schema/inv3.xsd">
A_location[@loc_ID=5]
</sql:xpath-query>
</ROOT>
-------------------------------------------------------------

Result (In browser):

- <ROOT xmlns:sql="urn:schemas-microsoft-com:xml-sql">
<?MSSQLError HResult="0x80004005" Source="Microsoft XML Extensions to SQL Server" Description="XPath: unable to find /A_location in the schema"?>
</ROOT>

--------------------------------------------------------------

Works with XDR schema:

<?xml version="1.0" encoding="windows-1252"?>
<!-- Generated by XMLMapper.exe XDR Publisher -->
<Schema xmlns="urn:schemas-microsoft-com:xml-data" xmlns:dt="urn:schemas-microsoft-com:datatypes" xmlns:sql="urn:schemas-microsoft-com:xml-sql">
<ElementType name="A_location" content="mixed" order="many">
<AttributeType name="loc_ID" dt:type="int"/>
<AttributeType name="location" dt:type="string"/>
<attribute type="loc_ID" required="no"/>
<attribute type="location" required="no"/>
</ElementType>
</Schema>

RESULTS:

- <ROOT xmlns:sql="urn:schemas-microsoft-com:xml-sql">
<A_location loc_ID="5" location="Guatemala" />
</ROOT>

-----------------------------------------------------------

Is there something I need to do in SQL server/IIS to enable xsd???
Or does anyone see a problem with my code?

mixedupone3
Starting Member

8 Posts

Posted - 2002-05-21 : 11:36:33
Just wanted to share my fix in case anyone in the future runs into the same problem.

I had to download a newer version of sqlxml. This updates the virtual directories on IIS to a version that allows .xsd schemas to work with .xml files.

Go to Top of Page
   

- Advertisement -