Guest chrisc Posted January 17, 2006 Share Posted January 17, 2006 Please help! I've spend 6 hours on this and for the life of me I can't get the XSD validator to pass my XSD/XML! The only way it would pass is by removing the targetNamespace attribute from the <schema> tag, and that's no good. Any help would be appreciated. THANKS!XSD: <?xml version="1.0" encoding="ISO-8859-1" ?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.sensorsoft.com/ns/rwme" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.00"><!-- Sensorsoft XML Format Version 1.0 --><!-- definition of simple elements --><!-- About Section --><xs:element name="applicationName" type="xs:string" /><xs:element name="xmlCreationDate" type="xs:date"/><xs:element name="xmlCreationTime" type="xs:time"/><xs:element name="company" type="xs:string" default="Sensorsoft"/><xs:element name="copyright" type="xs:string"/><xs:element name="numberOfUsersLoggedIn" type="xs:integer" default="1"/><xs:element name="serverStartDate" type="xs:date"/><xs:element name="serverStartTime" type="xs:time"/><xs:element name="hostName" type="xs:string"/><!-- item Section --><xs:element name="model" type="xs:string"/><xs:element name="vendor" type="xs:string" default="Sensorsoft"/><xs:element name="type" type="xs:string" default="Sensorsoft Device"/><xs:element name="itemDescription" type="xs:string"/><xs:element name="location" type="xs:string"/><xs:element name="comments" type="xs:string"/><xs:element name="numberOfSuccessfulReadings" type="xs:integer"/><xs:element name="lastSuccessfulReadingAt" type="xs:string"/><xs:element name="lastAttemptedReadingAt" type="xs:string"/><xs:element name="estimatedUptimeInMinutes" type="xs:integer"/><xs:element name="itemStatus" type="itemStatusType"/><xs:element name="firmwareVersion" type="xs:string"/><xs:element name="numberOfMonitoredVariables" type="xs:integer"/><!-- Variable Section --><xs:element name="name" type="xs:string"/><xs:element name="value" type="xs:double"/><xs:element name="variableStatus" type="xs:string"/><xs:element name="description" type="xs:string" default=""/><xs:element name="reading" type="xs:string"/><xs:element name="booleanOneState" type="xs:string" /><xs:element name="booleanZeroState" type="xs:string"/><xs:element name="unitOfMeasureShort" type="xs:string"/><xs:element name="unitOfMeasureLong" type="xs:string"/><!-- Group Section --><xs:element name="numberOfItems" type="xs:integer"/><xs:element name="numberOfSubGroups" type="xs:integer"/><!-- definition of simple attributes --><xs:attribute name="build" type="xs:string"/><xs:attribute name="method" type="connectionType"/><xs:attribute name="unit" type="timeType"/><xs:attribute name="type" type="variableType"/><xs:attribute name="count" type="xs:integer"/><xs:attribute name="id" type="xs:integer" default="0"/><xs:attribute name="name" type="xs:string"/><!-- definition of Simple Types --><xs:simpleType name="connectionType"> <xs:restriction base="xs:string"> <xs:pattern value="COM|TCP|UDP"/> </xs:restriction></xs:simpleType><xs:simpleType name="timeType"> <xs:restriction base="xs:string"> <xs:pattern value="min|sec"/> </xs:restriction></xs:simpleType><xs:simpleType name="variableType"> <xs:restriction base="xs:string"> <xs:pattern value="Scalar|Boolean"/> </xs:restriction></xs:simpleType><xs:simpleType name="itemStatusType"> <xs:restriction base="xs:string"> <xs:pattern value="Normal|ONLINE - TCP connection restored|Sensor Model Changed|OFFLINE - TCP connection problem|TIMEOUT - Sensor not responding|LOW SUPPLY VOLTAGE on sensor|TAMPER - check sensor|Communication Error|EEPROM Failure|"/> </xs:restriction></xs:simpleType><!-- definition of complex elements --><xs:element name="version"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute ref="build"/> </xs:extension> </xs:simpleContent> </xs:complexType></xs:element><xs:element name="about"> <xs:complexType> <xs:all> <xs:element ref="applicationName"/> <xs:element ref="hostName"/> <xs:element ref="version"/> <xs:element ref="xmlCreationDate"/> <xs:element ref="xmlCreationTime"/> <xs:element ref="company"/> <xs:element ref="copyright"/> <xs:element ref="numberOfUsersLoggedIn"/> <xs:element ref="serverStartDate"/> <xs:element ref="serverStartTime"/> </xs:all> <xs:attribute ref="build"/> </xs:complexType></xs:element><xs:element name="connectionTarget"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute ref="method"/> </xs:extension> </xs:simpleContent> </xs:complexType></xs:element><xs:element name="updateInterval"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:integer"> <xs:attribute ref="unit"/> </xs:extension> </xs:simpleContent> </xs:complexType></xs:element><xs:element name="variable"> <xs:complexType> <xs:all> <xs:element ref="name"/> <xs:element ref="reading"/> <xs:element ref="value" minOccurs="0"/> <xs:element ref="booleanZeroState" minOccurs="0"/> <xs:element ref="booleanOneState" minOccurs="0"/> <xs:element ref="unitOfMeasureShort" minOccurs="0"/> <xs:element ref="unitOfMeasureLong" minOccurs="0"/> <xs:element ref="variableStatus"/> <xs:element ref="description"/> </xs:all> <xs:attribute ref="type"/> <xs:attribute ref="id" use="optional"/> </xs:complexType></xs:element><xs:element name="variableList"> <xs:complexType> <xs:sequence> <xs:element ref="variable" maxOccurs="unbounded" minOccurs="0"/> </xs:sequence> </xs:complexType></xs:element><xs:element name="item"> <xs:complexType> <xs:all> <xs:element ref="model"/> <xs:element ref="vendor"/> <xs:element ref="type"/> <xs:element ref="itemStatus"/> <xs:element ref="itemDescription"/> <xs:element ref="location"/> <xs:element ref="connectionTarget"/> <xs:element ref="comments"/> <xs:element ref="numberOfSuccessfulReadings"/> <xs:element ref="lastSuccessfulReadingAt"/> <xs:element ref="lastAttemptedReadingAt"/> <xs:element ref="updateInterval"/> <xs:element ref="estimatedUptimeInMinutes"/> <xs:element ref="firmwareVersion"/> <xs:element ref="numberOfMonitoredVariables"/> <xs:element ref="variableList"/> </xs:all> <xs:attribute ref="id" use="optional" /> </xs:complexType></xs:element><xs:element name="itemList"> <xs:complexType> <xs:sequence> <xs:element ref="item" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType></xs:element><xs:element name="group"> <xs:complexType> <xs:sequence> <xs:element ref="numberOfSubGroups"/> <xs:element ref="group" minOccurs="0" maxOccurs="unbounded"/> <xs:element ref="numberOfItems"/> <xs:element ref="itemList" minOccurs="0"/> </xs:sequence> <xs:attribute ref="name"/> <xs:attribute ref="id" use="optional" /> </xs:complexType></xs:element><xs:element name="root"> <xs:complexType> <xs:all> <xs:element ref="about"/> <xs:element ref="group" minOccurs="1"/> </xs:all> </xs:complexType></xs:element></xs:schema> XML <?xml version="1.0" encoding="ISO-8859-1"?><!-- Sensorsoft XML Format Version 1.0 --><root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="RWME1000001.xsd"> <about> <applicationName>Sensorsoft Remote Watchman Enterprise</applicationName> <hostName>xman</hostName> <version build="227">2005</version> <xmlCreationDate>2006-01-17</xmlCreationDate> <xmlCreationTime>17:26:28</xmlCreationTime> <company>Sensorsoft Corp.</company> <copyright>Copyright (C) 2002-2005 Sensorsoft Corporation, All rights reserved.</copyright> <numberOfUsersLoggedIn>1</numberOfUsersLoggedIn> <serverStartDate>2006-01-05</serverStartDate> <serverStartTime>19:08:29</serverStartTime> </about> <group name="default"> <numberOfSubGroups>0</numberOfSubGroups> <numberOfItems>1</numberOfItems> <itemList> <item> <model>-</model> <vendor>-</vendor> <type>TCP Server Port</type> <itemStatus>Normal</itemStatus> <itemDescription>yahoo</itemDescription> <location>yahoo</location> <connectionTarget method="TCP">www.yahoo.com:80</connectionTarget> <comments></comments> <numberOfSuccessfulReadings>1</numberOfSuccessfulReadings> <lastSuccessfulReadingAt>Tue Jan 17 17:26:20 2006</lastSuccessfulReadingAt> <lastAttemptedReadingAt>Tue Jan 17 17:26:20 2006</lastAttemptedReadingAt> <updateInterval unit="min">1</updateInterval> <estimatedUptimeInMinutes>0</estimatedUptimeInMinutes> <firmwareVersion>-</firmwareVersion> <numberOfMonitoredVariables>2</numberOfMonitoredVariables> <variableList> <variable type="Boolean"> <name>SOCKET_CONNECT</name> <reading>UP</reading> <booleanZeroState>DOWN</booleanZeroState> <booleanOneState>UP</booleanOneState> <variableStatus>Normal</variableStatus> <description></description> </variable> <variable type="Boolean"> <name>SOCKET_RESPONSE</name> <reading>RESPOND OK</reading> <booleanZeroState>RESPOND FAIL</booleanZeroState> <booleanOneState>RESPOND OK</booleanOneState> <variableStatus>Normal</variableStatus> <description></description> </variable> </variableList> </item> </itemList> </group></root> Link to comment Share on other sites More sharing options...
steve_marjoribanks Posted March 14, 2006 Share Posted March 14, 2006 Well you're schema has a target namespace and your XML document is using a noNamespaceSchemaLocation attribute. The clue is in the name of the attribute. Try reading up on XML namespaces, it can be quite confusing! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now