Subject:Problem trying to use your software to validate XML and schema Author:Jonathan Jenkins Date:20 Jan 2009 01:44 AM
Below are the error messages I receive while using yoru software to vbalidate the attached XML document. As I only have one reference to an XSD I am unsure why your software is having a problem validating my XML document. Can you help step me thru thus process with yoru software?
file:///d:/Corps Strategies/signup_political.xml:3,148: schema document 'file:///d:/Corps%20Strategies/signup_political.xsd' has different target namespace from the one specified in instance document ''
file:///d:/Corps Strategies/signup_political.xml:3,148: no declaration found for element 'contacts'
The XML document signup_political.xml is NOT valid (2 errors)
Subject:Problem trying to use your software to validate XML and schema Author:Minollo I. Date:20 Jan 2009 02:08 PM
I can see several problems:
- The XML Schema you have attached has a wrong XML PI:
<?xml version="1.0" encoding="UTF-8"??>
You should fix that into:
<?xml version="1.0" encoding="UTF-8"?>
- The XML document declares xsi:noNamespaceSchemaLocation; but the referenced XML Schema specifies a targetNamespace; so, the XML document should associate the referenced XML Schema to that specific namespace:
<contacts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3schools.com signup_political.xsd">
- The XML Schema defines the "contact" element; but not the "contacts" element; so, validation will complain that "contacts" is not defined
- <contact> should use the target namespace of the schema; so, maybe you can change it to <contact xmlns="http://www.w3schools.com">
- The schema defines a number of sub-elements for <contact>; but your XML document uses attributes (that are not defined as part of the schema)