Saturday, February 25, 2012

"Could not find schema information ..." error in XSD annotation

When I open any annotated schema in VC# 2005 Express, I get the error:

"Could not find schema information for the attribute 'urn:schemas-microsoft-com:mapping-schema:relation'."

Am I missing a reference? MSXML4.0 and the SQL Client are installed on my workstation.

An example of one of the annotated schemas I've tried is this one, from Andrew Conrad's MSDN article "A Survey of Microsoft SQL Server 2000 XML Features":

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"

xmlns:sql="urn:schemas-microsoft-com:mapping-schema">

<xsd:element name="CustomerRecord" sql:relation="Customers" >

<xsd:complexType>

<xsd:sequence>

<xsd:element name="Contact" sql:field="ContactName"

type="xsd:string" />

... etc. All references to sql:relation, sql:field and sql:relationship produce the same error.

How do you open it?

Thanks

Michael

|||I was opening the schema in the standard editor pane and then clicking on Show Errors in one of the drop-down menus (can't remember which one that is, now). I dumped VC# 2005 Express in favor of C# in VS 2003 Enterprise, which validates the same schema with no problem. The documentation which installed with the Express edition was clearly meant for the standard VS product, anyway, and, so far, schema handling in VS 2003 appears to work as advertised.

Best Regards,

Mike
|||

I think the issue may be that the VC# 2005 editor by default expects all namespaces to have schemas associated. I am forwarding this to our schema editor experts to see what's going on.

Thanks

Michael

|||

The schema for these mapping annotations was not shipped in Visual Studio 2005. If you plop the following XSD schema into your "program files\visual studio 8\xml\schema" folder then the errors will go away:

<?xml version="1.0" encoding="utf-8" ?>

<xs:schema targetNamespace="urn:schemas-microsoft-com:mapping-schema"

elementFormDefault="qualified"

xmlns="urn:schemas-microsoft-com:mapping-schema"

xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:attribute name="encode" type="xs:anyURI">

<xs:annotation>

<xs:documentation>

When an XML element or attribute is mapped to a SQL Server BLOB column, allows requesting a reference URI. This URI can be used later to return BLOB data.

</xs:documentation>

</xs:annotation>

</xs:attribute>

<xs:attribute name="field" type="xs:string">

<xs:annotation>

<xs:documentation>Maps an XML item to a database column.</xs:documentation>

</xs:annotation>

</xs:attribute>

<xs:attribute name="guid" type="guid">

<xs:annotation>

<xs:documentation>

Allows you to specify whether to use a GUID value generated by SQL Server or use the value provided in the updategram for that column.

</xs:documentation>

</xs:annotation>

</xs:attribute>

<xs:attribute name="hide" type="xs:boolean">

<xs:annotation>

<xs:documentation>

Hides the element or attribute that is specified in the schema in the resulting XML document.

</xs:documentation>

</xs:annotation>

</xs:attribute>

<xs:attribute name="identity" type="guid">

<xs:annotation>

<xs:documentation>

Can be specified on any node that maps to an IDENTITY-type database column. The value specified for this annotation defines how the corresponding IDENTITY-type column in the database is updated.

</xs:documentation>

</xs:annotation>

</xs:attribute>

<xs:attribute name="inverse" type="xs:boolean">

<xs:annotation>

<xs:documentation>

Instructs the updategram logic to inverse its interpretation of the parent-child relationship that has been specified using &lt;sql:relationship&gt;

</xs:documentation>

</xs:annotation>

</xs:attribute>

<xs:attribute name="is-constant" type="xs:boolean">

<xs:annotation>

<xs:documentation>

Creates an XML element that does not map to any table. The element appears in the query output.

</xs:documentation>

</xs:annotation>

</xs:attribute>

<xs:attribute name="key-fields" type="xs:string">

<xs:annotation>

<xs:documentation>

Allows specification of column(s) that uniquely identify the rows in a table.

</xs:documentation>

</xs:annotation>

</xs:attribute>

<xs:attribute name="limit-field" type="xs:string">

<xs:annotation>

<xs:documentation>

Allows limiting the values that are returned on the basis of a limiting value.

</xs:documentation>

</xs:annotation>

</xs:attribute>

<xs:attribute name="limit-value" type="xs:string">

<xs:annotation>

<xs:documentation>

Allows limiting the values that are returned on the basis of a limiting value.

</xs:documentation>

</xs:annotation>

</xs:attribute>

<xs:attribute name="mapped" type="xs:boolean">

<xs:annotation>

<xs:documentation>

Allows schema items to be excluded from the result.

</xs:documentation>

</xs:annotation>

</xs:attribute>

<xs:attribute name="max-depth" type="xs:positiveInteger">

<xs:annotation>

<xs:documentation>

Allows you to specify depth in recursive relationships that are specified in the schema.

</xs:documentation>

</xs:annotation>

</xs:attribute>

<xs:attribute name="overflow-field" type="xs:string">

<xs:annotation>

<xs:documentation>

Identifies the database column that contains the overflow data.

</xs:documentation>

</xs:annotation>

</xs:attribute>

<xs:attribute name="prefix" type="xs:string">

<xs:annotation>

<xs:documentation>

Creates valid XML ID, IDREF, and IDREFS. Prepends the values of ID, IDREF, and IDREFS with a string.

</xs:documentation>

</xs:annotation>

</xs:attribute>

<xs:attribute name="relation" type="xs:string">

<xs:annotation>

<xs:documentation>

Maps an XML item to a database table.

</xs:documentation>

</xs:annotation>

</xs:attribute>

<xs:attribute name="relationship" type="xs:string">

<xs:annotation>

<xs:documentation>

Specifies relationships between XML elements. The parent, child, parent-key, and child-key attributes are used to establish the relationship.

</xs:documentation>

</xs:annotation>

</xs:attribute>

<xs:attribute name="use-cdata" type="xs:boolean">

<xs:annotation>

<xs:documentation>

Allows specifying CDATA sections to be used for certain elements in the XML document.

</xs:documentation>

</xs:annotation>

</xs:attribute>

<xs:simpleType name="guid">

<xs:restriction base="xs:string">

<xs:pattern value="\{[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\}"/>

</xs:restriction>

</xs:simpleType>

</xs:schema>

|||Thanks, Chris. That makes perfect sense. I saved the schema and will use it if I try VS C# Express again.

Mike
|||

Fine, but where in that folder should the schema be plopped?

Should I be able to deduce the file name from the info in the schema?

Or doesn't the fle name matter?

In that case, please explain the magic that allows it to be fetched in to cure the problem under discusssion

Regards,

Al

|||Al -

I'm no longer using VC# 2005 Express, but the schema name would be mapping-schema.xsd, and I think you would save it to the folder Program Files\Microsoft Visual Studio 8\Xml\Schemas.

There's probably a way to implicitly embed a xsi:schemaLocation directive in your annotated schema, so you could put the mapping-schema in your bin\Debug folder along with the program source files, but I can't figure out what such a directive would look like.

Good luck,

Mike
|||

What should the filename be?

|||

Did you ever find out how the file should be named? I am having the same endless messages and i would like to get rid of them.

Thanks,

|||

RoseD wrote:

Did you ever find out how the file should be named? I am having the same endless messages and i would like to get rid of them.

Thanks,

No. That is still a mystery, unfortunately.

It is absolutely ridiculous.

Releasing a service-pack or at least a patch would be VERY simple; but, the creators obviously have moved on to bigger and better things-- that is, sadly, pretty common for MS these days-- they move on to a new technology before they have fixed Version 1 of a release product. They keep adding bells-and-whistles but they often miss the core features. Oh well. They still have some of the best tools; I just wish there were a little more support for products by the way of services-packs, patches, and add-ons. In fact, I am sure they could have charged a nominal fee ($20, $50, even $100) for the Express tools and then they would have had a budget for product support.

Thank you.

-- Mark Kamoski

|||I wish I could give you a definitive answer, but as I said earlier, I switched to VS 2003 and the problem went away, so I never tried the solution proposed by Chris Lovett. Did you try naming the file "mapping-schema.xsd"? The full path would then be "Program Files\Visual Studio 8\xml\schema\mapping-schema.xsd".|||

This is an actual microsoft.com forum - isn't there a microsoft support engineer that can give a definitive answer to the question, what xsd file contains the xml schema info for remoting configuration files?

No comments:

Post a Comment