Yes, VS2003 can find the schema in question. It never complains that "Visual
Studio could not locate a schema for this document...". It is easy to verify
"Zafar Abbas [MSFT]" wrote:
> Your xml and xsd validate fine with the validation engine in VS 2003. Are
> you putting your schema file in the right location?
>
> "man-in-nature" <maninnature@discussions.microsoft.com> wrote in message
> news:DAB41CB7-C5A4-405A-8743-841E70521E39@microsoft.com...
> > Hello,
> >
> > I have already read several existing posts about xsd:extension, but do not
> > find something useful to my test case. I have one xml file and one xsd
> file.
> > I can use a simple command line (C#) program to validate the xml file
> against
> > the xsd file without any error. The problem is that when I validate the
> same
> > xml file within VisualStudio 2003, I got five errors, which are all
> related
> > to xsd:extension. It seems that those "problem" attributes and elements
> are
> > not inherited in the derived type. Here is one of the famous error:
> >
> > Could not find any attribute 'routingNum' of element 'hat'.
> >
> > Any input is appreciated much. Thanks.
> >
> > The following are the xml file and the xsd:
> >
> > <!--Definitive XML Schema by Priscilla Walmsley (c) 2001 Prentice Hall
> PTR -->
> > <c:items xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" > > xsi:schemaLocation="
http://chapter14.xsd > > http://localhost/xsd/chapter14.xsd"
> > xmlns:c="http://chapter14.xsd">
> > <hat routingNum="123456" effDate="2002-04-02" lang="en-US">
> > <number>557</number>
> > <name>Ten-Gallon Hat</name>
> > <description>This is a great hat!</description>
> > </hat>
> > <umbrella routingNum="123" effDate="2002-04-02">
> > <number>557</number>
> > <name>Ten-Gallon Hat</name>
> > </umbrella>
> > <shirt routingNum="124" effDate="2002-04-02" sleeve="17">
> > <number>557</number>
> > <name>Short-Sleeved Linen Blouse</name>
> > <color value="blue"/>
> > <size system="US-DRESS">6</size>
> > </shirt>
> > </c:items>
> >
> > ---------------------------------------------------
> > <!--Definitive XML Schema by Priscilla Walmsley (c) 2001 Prentice Hall
> PTR -->
> > <xsd:schema xmlns:xsd="
http://www.w3.org/2001/XMLSchema" > > targetNamespace="http://chapter14.xsd"
> > xmlns="http://chapter14.xsd">
> >
> > <xsd:annotation>
> > <xsd:documentation>
> > This example illustrates complex types that are derived from other
> > specified types.
> > </xsd:documentation>
> > </xsd:annotation>
> >
> > <xsd:element name="items" type="ItemsType"/>
> >
> > <xsd:complexType name="ItemsType">
> > <xsd:choice minOccurs="0" maxOccurs="unbounded">
> > <xsd:element name="hat" type="ProductType"/>
> > <xsd:element name="umbrella" type="RestrictedProductType"/>
> > <xsd:element name="shirt" type="ShirtType"/>
> > </xsd:choice>
> > </xsd:complexType>
> >
> > <!--Empty Content Type-->
> > <xsd:complexType name="ItemType" abstract="true">
> > <xsd:attribute name="routingNum" type="xsd:integer"/>
> > </xsd:complexType>
> >
> > <!--Empty Content Extension (with Attribute Extension)-->
> > <xsd:complexType name="ProductType">
> > <xsd:complexContent>
> > <xsd:extension base="ItemType">
> > <xsd:sequence>
> > <xsd:element name="number" type="xsd:integer"/>
> > <xsd:element name="name" type="xsd:string"/>
> > <xsd:element name="description" type="xsd:string"
> minOccurs="0"/>
> > </xsd:sequence>
> > <xsd:attribute name="effDate" type="xsd:date"/>
> > <xsd:attribute name="lang" type="xsd:language"/>
> > </xsd:extension>
> > </xsd:complexContent>
> > </xsd:complexType>
> >
> > <!--Complex Content Restriction-->
> > <xsd:complexType name="RestrictedProductType">
> > <xsd:complexContent>
> > <xsd:restriction base="ProductType">
> > <xsd:sequence>
> > <xsd:element name="number" type="xsd:integer"/>
> > <xsd:element name="name" type="xsd:token"/>
> > </xsd:sequence>
> > <xsd:attribute name="routingNum" type="xsd:short" use="required"/>
> > <xsd:attribute name="effDate" type="xsd:date"
> default="1900-01-01"/>
> > <xsd:attribute name="lang" use="prohibited"/>
> > </xsd:restriction>
> > </xsd:complexContent>
> > </xsd:complexType>
> >
> > <!--Complex Content Extension-->
> > <xsd:complexType name="ShirtType">
> > <xsd:complexContent>
> > <xsd:extension base="RestrictedProductType">
> > <xsd:choice maxOccurs="unbounded">
> > <xsd:element name="size" type="SmallSizeType"/>
> > <xsd:element name="color" type="ColorType"/>
> > </xsd:choice>
> > <xsd:attribute name="sleeve" type="xsd:integer"/>
> > </xsd:extension>
> > </xsd:complexContent>
> > </xsd:complexType>
> >
> > <!--Simple Content Extension-->
> > <xsd:complexType name="SizeType">
> > <xsd:simpleContent>
> > <xsd:extension base="xsd:integer">
> > <xsd:attribute name="system" type="xsd:token"/>
> > </xsd:extension>
> > </xsd:simpleContent>
> > </xsd:complexType>
> >
> > <!--Simple Content Restriction-->
> > <xsd:complexType name="SmallSizeType">
> > <xsd:simpleContent>
> > <xsd:restriction base="SizeType">
> > <xsd:minInclusive value="2"/>
> > <xsd:maxInclusive value="6"/>
> > <xsd:attribute name="system" type="xsd:token"
> > use="required"/>
> > </xsd:restriction>
> > </xsd:simpleContent>
> > </xsd:complexType>
> >
> > <xsd:complexType name="ColorType">
> > <xsd:attribute name="value" type="xsd:string"/>
> > </xsd:complexType>
> >
> > </xsd:schema>
> >
>
>