Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries [Thread Prev] >Thread Next - Re: Validate xml data in VS.net 2003 Validate xml data in VS.net 2003To: NULL Date: 6/3/2005 12:12:00 PM Hi everyone,
i have a simple xml document and its xsd as attached below. When i try to
validate the xml in VS.net 2003 by clicking [XML->Validate XML Data] menu, I
got the error:
C:\PlantStructure.xml(1): The 'urn:myschema-aprs:PlantStructure' element is
not declared. An error occurred at , (1, 2).
C:\PlantStructure.xml(1): Visual Studio could not locate a schema for this
document. Validation can only ensure this is a well formed XML document and
cannot validate the data against a schema.
...
Both files are localed under c:\
My VS.net 2003 build number is 7.1.3088, and .net framework is 1.1.4322
Can anyone help me to figure it out?
Thanks
PlantStructure.xsd:
<?xml version="1.0"?>
<xsd:schema id="aprs" targetNamespace="urn:myschema-aprs"
xmlns="urn:myschema-aprs" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
attributeFormDefault="unqualified" elementFormDefault="qualified">
<xsd:simpleType name="ItemTag">
<xsd:restriction base="xsd:string">
<xsd:minLength value="0"/>
<xsd:maxLength value="100"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="Active">
<xsd:restriction base="xsd:int">
<xsd:minInclusive value="0"/>
<xsd:maxInclusive value="1"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="ObjectType">
<xsd:restriction base="xsd:int">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="2"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="ObjectName">
<xsd:restriction base="xsd:string">
<xsd:minLength value="0"/>
<xsd:maxLength value="50"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="PlantStructure" msdata:IsDataSet="true"
msdata:EnforceConstraints="False">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="Object">
<xsd:complexType>
<xsd:attribute name="ObjectID" type="ItemTag" />
<xsd:attribute name="ObjectType" type="ObjectType" />
<xsd:attribute name="ParentID" type="ItemTag" />
<xsd:attribute name="ObjectName" type="ObjectName" />
<xsd:attribute name="Active" type="Active" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
PlantStructure.xml:
<PlantStructure xmlns="urn:myschema-aprs"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:myschema-aprs PlantStructure.xsd">
<Object ObjectID="./2.1/2.1" ObjectType="1" ParentID="" ObjectName="My
plant" Active="1" />
<Object ObjectID="./2.6/2.6" ObjectType="1" ParentID="./2.1/2.1"
ObjectName="Line 1" Active="1" />
<Object ObjectID="./2.2/2.2" ObjectType="1" ParentID="./2.6/2.6"
ObjectName="Loop 1" Active="1" />
<Object ObjectID="./2.3/2.3" ObjectType="1" ParentID="./2.6/2.6"
ObjectName="Loop 2" Active="1" />
<Object ObjectID="./2.4/2.4" ObjectType="1" ParentID="./2.6/2.6"
ObjectName="Loop 3" Active="1" />
</PlantStructure>
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
