What is wrong with my schema?
Posted: Mon Feb 07, 2005 11:44 pm
xml:
and the schema (automaticaly generated, I only added targetNamespace="...")
If I try to validate the schema, I get this:
I don't understand what the validator wants from me
thanks
tom
Code: Select all
<?xml version="1.0" encoding="ISO-8859-1"?>
<data xmlns="http://www.example.net/test"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.example.net/test test.xsd">
<foo>dfgsdgf</foo>
<bar>blabla</bar>
</data>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
targetNamespace="http://www.example.net/test">
<xs:element name="data">
<xs:complexType>
<xs:sequence>
<xs:element ref="foo"/>
<xs:element ref="bar"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="foo" type="xs:NCName"/>
<xs:element name="bar" type="xs:NCName"/>
</xs:schema>
and if I try to validate the xml, I get this:src-resolve.4.1: Error resolving component 'foo'. It was detected that 'foo' has no namespace, but components with no target namespace are not referenceable from schema document 'file:/D:/eclipse/workspace/test/test.xsd'. If 'foo' is intended to have a namespace, perhaps a prefix needs to be provided. If it is intended that 'foo' has no namespace, then an 'import' without a "namespace" attribute should be added to 'file:/D:/eclipse/workspace/test/test.xsd'.
@see: http://www.w3.org/TR/xmlschema-1/#src-resolve
What am I doing wrong?cvc-complex-type.2.4.d: Invalid content was found starting with element 'foo'. No child element is expected at this point.
@see: http://www.w3.org/TR/xmlschema-1/#cvc-complex-type
I don't understand what the validator wants from me

thanks
tom