[xml] xml schema validation and xmlns attribute



hi hi,

I've got a very basic problem with schema validation. Below are minial example
files.
Any ideas? And sorry if it is not libxml releated and just my failure in
understanding xml schema.

Stefan

-- case1
xmllint --noout --schema ./schema1.xsd ./doc1.xml
./doc1.xml validates

-- case2
xmllint --noout --schema ./schema1.xsd ./doc2.xml
./doc2.xml:2: element buzztard: Schemas validity error : Element buzztard not
declared
./doc2.xml:2: element buzztard: Schemas validity error : Element buzztard not
declared
./doc2.xml fails to validate

-- case3
xmllint --noout --schema ./schema2.xsd ./doc2.xml
./schema2.xsd:3: element attribute: Schemas parser error : Element 'attribute',
attribute 'name' ['NCName']: The value must not match 'xmlns'.



--- doc1.xml
<?xml version="1.0" encoding="UTF-8"?>
<buzztard/>

--- doc2.xml
<?xml version="1.0" encoding="UTF-8"?>
<buzztard xmlns="http://buzztard.sourceforge.net"/>

-- schema1.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
 <xsd:element name="buzztard" type="xsd:string"/>
</xsd:schema>

-- schema2.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
 <xsd:attribute name="xmlns" type="xsd:string"/>
 <xsd:element name="buzztard">
       <xsd:complexType>
           <xsd:attribute ref="xmlns"/>
       </xsd:complexType>
   </xsd:element>
</xsd:schema>


xmllint --version
xmllint: using libxml version 20612
  compiled with: DTDValid FTP HTTP HTML C14N Catalog XPath XPointer XInclude
Iconv Unicode Regexps Automata Schemas

Many thanks

Stefan
-- 

Attachment: kost.vcf
Description: Vcard



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]