Jump to content

Validation Problems

Guest whack

Recommended Posts

Guest whack

Hi there,I've done the schema tutorial on the site and followed instructions yet I'm having problems with my XML doc validation. I'm at my wits end to find what the problem is as this should be "bread and butter" stuff. I've created both a schema and an xml doc which are below and I've been trying to validate them using this site: http://apps.gotdotnet.com/xmltools/xsdvalidator/default.aspx . Alone, the schema validates fine (as well as on the W3C XSV validator) but trying to validate the XML doc is giving me errors such as:"Could not find schema information for the element 'http://www.stis.com:query'"where query is my root node. But it goes on to give this error for every element in my xml doc. Obviously it is do with the namespaces or the schemaLocation but I can't see what the problem is as the targetNameSpace and the xmlns/schemaLocation are the same in both docs and both are in the same directory....It is more than likely something extremely simple that I am overlooking but at this stage I'm code blind :-(Any help or tips would be greatly appreciated.....Thanks,Pat :-)query.xml

<?xml version="1.0"?><query xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.stis.com"xsi:schemaLocation="http://www.stis.com stisRequest.xsd">	<formatChoice>sms</formatChoice>	<time>2006-04-24T03:16:37</time>	<maxTimeToTravel>15</maxTimeToTravel>	<stagesQuery queryID="1">  <start>Fugazi Avenue</start>  <end>Long View Road</end>  <travelChoice>bus</travelChoice>  <waypoint>shelbourne</waypoint>  <waypoint>museum</waypoint>	</stagesQuery></query>


<?xml version="1.0" encoding="ISO-8859-1" ?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"targetNamespace="http://www.stis.com"xmlns="http://www.stis.com" elementFormDefault="qualified">	<xs:element name="sessionID" type="xs:long"/>	<xs:attribute name="queryID" type="xs:int"/>	<xs:element name="time" type="xs:dateTime"/>	<xs:element name="start" type="xs:token"/>	<xs:element name="end" type="xs:token"/>	<xs:element name="waypoint" type="xs:token"/>	<xs:element name="maxTimeToTravel" type="xs:duration"/>	<xs:element name="arrivalTimeAtDestination" type="xs:int"/>	<xs:element name="timeWindow" type="xs:iduration"/>	<xs:attributeGroup name="stageID">  <xs:attribute name="queryID" type="xs:int"/>	</xs:attributeGroup>		<xs:simpleType name="distance">  <xs:restriction base="xs:decimal"> 	 <xs:minExclusive value="0"/> 	 <xs:maxInclusive value="1.5"/>  </xs:restriction>	</xs:simpleType>	<xs:element name="maxDistanceToTravel" type="distance"/>	<xs:simpleType name="travelType">  <xs:restriction base="xs:string"> 	 <xs:enumeration value="luas"/> 	 <xs:enumeration value="bus"/> 	 <xs:enumeration value="walk"/> 	 <xs:enumeration value="cycle"/>  </xs:restriction>	</xs:simpleType>	<xs:element name="travelChoice" type="travelType"/>	<xs:simpleType name="infoFormat">  <xs:restriction base="xs:string"> 	 <xs:enumeration value="sms"/> 	 <xs:enumeration value="mms"/> 	 <xs:enumeration value="pda"/>  </xs:restriction>	</xs:simpleType>	<xs:element name="formatChoice" type="infoFormat"/>	<xs:complexType name="transportTimeWindow">  <xs:sequence> 	 <xs:element ref="travelChoice"/> 	 <xs:element ref="timeWindow"/>  </xs:sequence>		</xs:complexType>	<xs:element name="departsWithinTimeWindow" type="transportTimeWindow"/>  <xs:group name="simpleQuery">  <xs:sequence> 	 <xs:element ref="start"/> 	 <xs:element ref="end"/> 	 <xs:element ref="travelChoice" maxOccurs="3"/> 	 <xs:element ref="waypoint" minOccurs="0" maxOccurs="5"/> 	 <xs:element ref="arrivalTimeAtDestination" minOccurs="0"/>  </xs:sequence>	</xs:group> 	<xs:complexType name="stage">  <xs:sequence> 	 <xs:element ref="start"/> 	 <xs:element ref="end"/> 	 <xs:element ref="travelChoice" maxOccurs="3"/> 	 <xs:element ref="waypoint" minOccurs="0" maxOccurs="2"/> 	 <xs:element ref="arrivalTimeAtDestination" minOccurs="0"/>  </xs:sequence>  <xs:attribute ref="queryID"/>	</xs:complexType> 	<xs:element name="stagesQuery" type="stage"/>	<xs:element name="query">  <xs:complexType> 	 <xs:sequence>    <xs:element ref="formatChoice"/>    <xs:element ref="sessionID" minOccurs="0"/>    <xs:element ref="maxTimeToTravel" minOccurs="0"/>    <xs:element ref="maxDistanceToTravel" minOccurs="0"/>    <xs:element ref="departsWithinTimeWindow" minOccurs="0"/>    <xs:choice>   	 <xs:group ref="simpleQuery"/>   	 <xs:element ref="stagesQuery" maxOccurs="5"/>    </xs:choice> 	 </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...