trouble with annotated xsd mapping schemas - XML SOAP
This is a discussion on trouble with annotated xsd mapping schemas - XML SOAP ; I have two mapping schemas set up in the same directory under the same
virtual name in the same SQL Server virtual directory pointing to the
Northwind db. One is an xdr schema and one is an xsd schema, taken ...
-
trouble with annotated xsd mapping schemas
I have two mapping schemas set up in the same directory under the same
virtual name in the same SQL Server virtual directory pointing to the
Northwind db. One is an xdr schema and one is an xsd schema, taken more
or less verbatim from MSDN samples:
<!-- XDR SCHEMA -->
<?xml version="1.0"?>
<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="Customer" sql:relation="Customers">
<AttributeType name="CustomerID"/>
<AttributeType name="ContactName"/>
<AttributeType name="Phone"/>
<attribute type="CustomerID"/>
<attribute type="ContactName"/>
<attribute type="Phone"/>
</ElementType>
</Schema>
<!-- XSD SCHEMA -->
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
<xsd:element name="Customer" sql:relation="Customers">
<xsd:complexType>
<xsd:attribute name="CustomerID" sql:field="CustomerID"
type="xsd:string"/>
<xsd:attribute name="ContactName" sql:field="ContactName"
type="xsd:string"/>
<xsd:attribute name="Phone" sql:field="Phone" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:schema>
Here are the templates I'm using to issue an xpath query
<!-- CALL USING XDR SCHEMA -->
<ROOT xmlns:sql="urn:schemas-microsoft-com:xml-sql">
<sql:xpath-query
mapping-schema="D:\MyDirectory\Schemas\Northwind.xdr">/Customer</sql:xpath-query>
</ROOT>
<!-- CALL USING XSD SCHEMA -->
<ROOT xmlns:sql="urn:schemas-microsoft-com:xml-sql">
<sql:xpath-query
mapping-schema="D:\MyDirectory\Schemas\Northwind.xsd">/Customer</sql:xpath-query>
</ROOT>
Everything works fine when I specify the XDR schema, but when I specify
the XSD schema, I get this error:
<ROOT xmlns:sql="urn:schemas-microsoft-com:xml-sql">
<?MSSQLError HResult="0x80004005" Source="Microsoft XML Extensions to
SQL Server" Description="XPath: unable to find /Customer in the
schema"?>
</ROOT>
Am I blind and missing something simple in the schema definition, or is
there some other problem? It does not look like a SQL/IIS virtual
directory or virtual name configuration issue, because both schemas are
in the exact same location, and the xdr one works fine. Thanks!
-
Re: trouble with annotated xsd mapping schemas
The XSD schema is valid and should work fine. Could you please verify that
the XSD you posted here is same with the one you are using? The error you
get indicates that there is no root element named as "Customer" while
obviously the posted one has.
You may also try some other XSD's to see if they are working.
--
Bertan ARI
This posting is provided "AS IS" with no warranties, and confers no rights.
"qcanoe" <ascilipoti@unumprovident.com> wrote in message
news:1132005582.646396.291640@g44g2000cwa.googlegroups.com...
>I have two mapping schemas set up in the same directory under the same
> virtual name in the same SQL Server virtual directory pointing to the
> Northwind db. One is an xdr schema and one is an xsd schema, taken more
> or less verbatim from MSDN samples:
>
> <!-- XDR SCHEMA -->
> <?xml version="1.0"?>
> <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="Customer" sql:relation="Customers">
> <AttributeType name="CustomerID"/>
> <AttributeType name="ContactName"/>
> <AttributeType name="Phone"/>
>
> <attribute type="CustomerID"/>
> <attribute type="ContactName"/>
> <attribute type="Phone"/>
> </ElementType>
> </Schema>
>
> <!-- XSD SCHEMA -->
> <?xml version="1.0"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
> <xsd:element name="Customer" sql:relation="Customers">
> <xsd:complexType>
> <xsd:attribute name="CustomerID" sql:field="CustomerID"
> type="xsd:string"/>
> <xsd:attribute name="ContactName" sql:field="ContactName"
> type="xsd:string"/>
> <xsd:attribute name="Phone" sql:field="Phone" type="xsd:string"/>
> </xsd:complexType>
> </xsd:element>
> </xsd:sequence>
> </xsd:schema>
>
> Here are the templates I'm using to issue an xpath query
>
> <!-- CALL USING XDR SCHEMA -->
> <ROOT xmlns:sql="urn:schemas-microsoft-com:xml-sql">
> <sql:xpath-query
> mapping-schema="D:\MyDirectory\Schemas\Northwind.xdr">/Customer</sql:xpath-query>
> </ROOT>
>
> <!-- CALL USING XSD SCHEMA -->
> <ROOT xmlns:sql="urn:schemas-microsoft-com:xml-sql">
> <sql:xpath-query
> mapping-schema="D:\MyDirectory\Schemas\Northwind.xsd">/Customer</sql:xpath-query>
> </ROOT>
>
> Everything works fine when I specify the XDR schema, but when I specify
> the XSD schema, I get this error:
>
> <ROOT xmlns:sql="urn:schemas-microsoft-com:xml-sql">
> <?MSSQLError HResult="0x80004005" Source="Microsoft XML Extensions to
> SQL Server" Description="XPath: unable to find /Customer in the
> schema"?>
> </ROOT>
>
> Am I blind and missing something simple in the schema definition, or is
> there some other problem? It does not look like a SQL/IIS virtual
> directory or virtual name configuration issue, because both schemas are
> in the exact same location, and the xdr one works fine. Thanks!
>
-
Re: trouble with annotated xsd mapping schemas
Thanks. For some reason my SQL / IIS utility took several hours - even
with a lot of messing around in there - to "recognize" that it had been
upgraded to SQLXML 3.0. Once that happened (I got the "upgrade" tab in
the properties dialog for the virtual directory in question) I was
fine. Frustrating, but all's well that ends well, I guess. Thanks
anyway.
Similar Threads
-
By Application Development in forum XML SOAP
Replies: 2
Last Post: 08-28-2007, 05:55 AM
-
By Application Development in forum XML SOAP
Replies: 0
Last Post: 09-26-2006, 12:59 PM
-
By Application Development in forum XML SOAP
Replies: 0
Last Post: 09-11-2006, 09:24 AM
-
By Application Development in forum XML SOAP
Replies: 0
Last Post: 09-08-2006, 05:16 PM
-
By Application Development in forum XML SOAP
Replies: 0
Last Post: 12-14-2005, 05:27 PM