I created the following XSD (with Eclipse):
<?xml version="1.0" encoding="UTF-8"?> <schema targetNamespace="http://www.example.com" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.example.com"> <element name="Make"> <complexType> <sequence> <element name="Scope"></element> </sequence> </complexType> </element> </schema>
and validation using this simple XML
<?xml version="1.0"?> <Make xmlns="http://www.example.com"> <Scope> </Scope> </Make>
gives:
xmllint.exe --noout --schema sources.xsd sources.xml sources.xml:3: element Scope: Schemas validity error : Element '{http://www.example.com}Scope': This element is not expected. Expected is ( Scope ). sources.xml fails to validate
In my opinion, this one should be correct: the XML file is located in the http://www.example.com namespace (which the validator also says).
And for XSD, I set the default namespace to the XSD schema (this is what Eclipse does, so it should be right!), And I give the correct targetNamespace name. I also tried to use
<element name="tnd:Scope" />
However, this does not work either.
Is this a bug in xmllint or where is the problem?
DIVB Relations
source share