Jump to content

XML document can't find schema


steve_marjoribanks

Recommended Posts

I have written an XML file in Visual Studio.Net and then it has created a schema for me (hence there a few unecessary namespace references in there). The problem is that when i try to validate the xml file against the schema in Visual Studio it says it cannot locate the schema document, even though all the paths specified are correct. It could be a problem with Visual Studio because there are a few other features which are a bit iffy. I have tried looking for online tools that will check a document against a schema but only found http://apps.gotdotnet.com/xmltools/xsdvalidator/ which is offline at the moment!Is there any other way for me to check it, or can any of you see any errors i have made in the code? I'm not too bothered if there are a few small errors in the schema with regards to the syntax of the xml file at the moment but i just want to know why Visual Studio cannot locate the schema file to check againstMany thanksPractice.xml

<?xml version="1.0" encoding="UTF-8"?><GeotechnicalProject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns="http://www.dur.ac.uk/s.j.marjoribanks"  xsi:schemaLocation="practice.xsd">    <projectDetails>        <title>Practice XML file</title>        <date>2005-11-09</date>        <author>Stephen Marjoribanks</author>        <revision />        <notes>Sample borehole data taken from RF Craig Soil Mechanics 6th Edition, Table 10.1 pg419</notes>    </projectDetails>    <project>        <SiteInvestigation>            <holes>                <Borehole>                    <holeDetails>                        <Location>Barnhill</Location>                        <Method>Shell	&	Auger	to 14.4m,	Rotary core	drilling to	17.8m</Method>                        <Diameter>150</Diameter>                    </holeDetails>                    <groundProfile>                        <layer>                            <Top>0.00</Top>                            <Bottom>0.70</Bottom>                            <Name>Topsoil</Name>                            <Description>Topsoil</Description>                        </layer>                        <layer>                            <Top>0.70</Top>                            <Bottom>2.60</Bottom>                            <Name>Sand</Name>                            <Description>Loose,	lightly	brown	SAND</Description>                            <Constituent>                                <description>Sand</description>                                <type>Soil</type>                                <consistency>Loose</consistency>                                <mainColour>Light	brown</mainColour>                                <amount>Main</amount>                            </Constituent>                        </layer>                        <layer>                            <Top>2.60</Top>                            <Bottom>4.40</Bottom>                            <Name>Gravelly Sand</Name>                            <Description>Medium	dense, brown gravelly	SAND</Description>                            <Constituent>                                <description>Sand</description>                                <type>Soil</type>                                <consistency>Medium	dense</consistency>                                <mainColour>Brown</mainColour>                                <amount>Main</amount>                            </Constituent>                        </layer>                        <layer>                            <Top>4.40</Top>                            <Bottom>12.20</Bottom>                            <Name>Clay</Name>                            <Description>Firm	to stiff,	yellowish	brown, closely fissured	CLAY of	high plasticity</Description>                            <Constituent>                                <description>Clay</description>                                <type>Soil</type>                                <consistency>Firm	to Stiff</consistency>                                <plasticity>High</plasticity>                                <mainColour>Brown</mainColour>                                <secondaryColour>Yellow</secondaryColour>                                <amount>Main</amount>                                <notes>Closely fissured</notes>                            </Constituent>                        </layer>                        <layer>                            <Top>12.20</Top>                            <Bottom>14.40</Bottom>                            <Name>Sand</Name>                            <Description>Very	dense, red,	silty	SAND with	decomposed SANDSTONE</Description>                            <Constituent>                                <description>Sand</description>                                <type>Soil</type>                                <consistency>Very	dense</consistency>                                <mainColour>Red</mainColour>                                <amount>Main</amount>                                <notes>Silty</notes>                            </Constituent>                            <Constituent>                                <description>Sandstone</description>                                <type>Rock</type>                                <consistency>Decomposed</consistency>                                <mainColour />                                <amount>Secondary</amount>                            </Constituent>                        </layer>                        <layer>                            <Top>14.40</Top>                            <Bottom>17.80</Bottom>                            <Name>Sandstone</Name>                            <Description>Red,	medium-grained,	granular,	fresh	SANDSTONE, moderately	weak,	thickly	bedded</Description>                            <Constituent>                                <description>Sandstone</description>                                <type>Rock</type>                                <consistency>Granular</consistency>                                <mainColour>Red</mainColour>                                <grainSize>Medium</grainSize>                                <strength>Moderately weak</strength>                                <bedding>Thickly bedded</bedding>                                <notes>Fresh</notes>                            </Constituent>                        </layer>                    </groundProfile>                </Borehole>            </holes>        </SiteInvestigation>    </project></GeotechnicalProject>

Practice.xsd

<?xml version="1.0" encoding="UTF-8" ?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"	targetNamespace="http://www.dur.ac.uk/s.j.marjoribanks"	<!--xmlns="http://www.dur.ac.uk/s.j.marjoribanks"-->	<xs:element name="GeotechnicalProject">  <xs:complexType> 	 <xs:sequence>    <xs:element name="projectDetails">   	 <xs:complexType>      <xs:sequence>     	 <xs:element name="title" type="xs:string" minOccurs="1" />     	 <xs:element name="date" type="xs:date" minOccurs="0" />     	 <xs:element name="author" type="xs:string" minOccurs="0" />     	 <xs:element name="revision" type="xs:string" minOccurs="0" />     	 <xs:element name="notes" type="xs:string" minOccurs="0" />      </xs:sequence>   	 </xs:complexType>    </xs:element>    <xs:element name="project">   	 <xs:complexType>      <xs:sequence>     	 <xs:element name="SiteInvestigation" minOccurs="0" maxOccurs="unbounded">        <xs:complexType>       	 <xs:sequence>          <xs:element name="holes" minOccurs="0" maxOccurs="unbounded">         	 <xs:complexType>            <xs:sequence>           	 <xs:element name="Borehole" minOccurs="0" maxOccurs="unbounded">              <xs:complexType>             	 <xs:sequence>                <xs:element name="holeDetails" minOccurs="0" maxOccurs="unbounded">               	 <xs:complexType>                  <xs:sequence>                 	 <xs:element name="Location" type="xs:string" minOccurs="0" maxOccurs="1" />                 	 <xs:element name="Method" type="xs:string" minOccurs="0" maxOccurs="1" />                 	 <xs:element name="Diameter" type="xs:string" minOccurs="0" maxOccurs="1" />                  </xs:sequence>               	 </xs:complexType>                </xs:element>                <xs:element name="groundProfile" minOccurs="0" maxOccurs="1">               	 <xs:complexType>                  <xs:sequence>                 	 <xs:element name="layer" minOccurs="0" maxOccurs="unbounded">                    <xs:complexType>                   	 <xs:sequence>                      <xs:element name="Top" type="xs:float" fixed="1" />                      <xs:element name="Bottom" type="xs:float" fixed="1" />                      <xs:element name="Name" type="xs:string" minOccurs="0" />                      <xs:element name="Description" type="xs:string" minOccurs="0" />                      <xs:element name="Constituent" minOccurs="1" maxOccurs="unbounded">                     	 <xs:complexType>                        <xs:sequence>                       	 <xs:element name="description" type="xs:string" minOccurs="0" />                       	 <xs:element name="type" type="xs:string" fixed="1" />                       	 <xs:element name="consistency" type="xs:string" minOccurs="0" />                       	 <xs:element name="mainColour" type="xs:string" minOccurs="0" />                       	 <xs:element name="amount" type="xs:string" minOccurs="0" />                       	 <xs:element name="plasticity" type="xs:string" minOccurs="0" />                       	 <xs:element name="secondaryColour" type="xs:string" minOccurs="0" />                       	 <xs:element name="notes" type="xs:string" minOccurs="0" />                       	 <xs:element name="grainSize" type="xs:string" minOccurs="0" />                       	 <xs:element name="strength" type="xs:string" minOccurs="0" />                       	 <xs:element name="bedding" type="xs:string" minOccurs="0" />                        </xs:sequence>                     	 </xs:complexType>                      </xs:element>                   	 </xs:sequence>                    </xs:complexType>                 	 </xs:element>                  </xs:sequence>               	 </xs:complexType>                </xs:element>             	 </xs:sequence>              </xs:complexType>           	 </xs:element>            </xs:sequence>         	 </xs:complexType>          </xs:element>       	 </xs:sequence>        </xs:complexType>     	 </xs:element>      </xs:sequence>   	 </xs:complexType>    </xs:element> 	 </xs:sequence>  </xs:complexType>	</xs:element></xs:schema>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...