If I’m defining a schema (using Visual Studio 2010’s XML Editor) for a business object, how can I import external namespaces? I’m extending the schema for Google Commerce Search, but how do I define the namespace-prefixed elements? e.g. when querying some of my product data, one element ,edited, belonging to the app namespace looks like:
<app:edited>2012-01-17T17:22:05.182Z</app:edited>
Visual Studio suggests I might need to import the .xsd file for the http://www.w3.org/2007/app namespace. Do I need to find other .xsd files for the rest of the namespaces already included in the Google product feeds? e.g. xmlns:sc and xmlns:scp Where do I find these? Or am I going about this completely wrong?
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="entry"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3.org/2005/Atom"
elementFormDefault="qualified"
xmlns="http://www.w3.org/2005/Atom"
xmlns:app="http://www.w3.org/2007/app"
xmlns:sc="http://schemas.google.com/structuredcontent/2009"
xmlns:scp="http://schemas.google.com/structuredcontent/2009/products">
<xs:element name="entry">
<xs:complexType>
<xs:sequence>
<xs:element name="id" type="xs:anyURI"></xs:element>
<xs:element name="published" type="xs:date"></xs:element>
<xs:element name="updated" type="xs:date"></xs:element>
<xs:element name="title" type="xs:string"></xs:element>
<!-- how do I define the <app:edited type="date" /> element here?? -->
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
You first need to get hold of the schemas. Then you can add them into visual studio’s schema store:
This means that any XML instance documents you author in visual studio have access to the schema store from a validation perspective.
Then you modify your schema. First import the new schema:
Then make a reference to the type you want to use from that schema