Altova Mailing List Archives


Re: Validate xml data in VS.net 2003

From: "Chris Lovett" <someone@------.------>
To: NULL
Date: 6/7/2005 10:13:00 PM
I believe Visual Studio 2003 also supports finding the schema if it's 
included in your project.

Note also that Visual Studio 2005 supports many more options in locating 
your schemas, including a convenient document property that can be used to 
point at your schema, as well as support for schemaLocation attributes.

"peter" <peter@d...> wrote in message 
news:8E865509-F787-416E-AC33-06B67EA10E51@m......
> Thank you very much. When I copied the schema to that folder, it validated 
> OK.
>
> Thanks again.
>
>
> "Zafar Abbas [MSFT]" wrote:
>
>> Where do you have the schema file located? In VS 2003 it has to be 
>> located
>> in the \schemas directory under the VS folder.
>>
>> "peter" <peter@d...> wrote in message
>> news:5CA3F6D6-CABB-46B9-8C0B-6FEA40F9D9CA@m......
>> > 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>
>> >
>>
>>
>> 


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.