Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Validate xml data in VS.net 2003

From: peter@-----------.---------.---
To: 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>



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent