'Re: "Re: [xml] xml:lang attribute with xmllint"'



Hi,

on 6/2/2004 3:44 PM Daniel Veillard wrote:

On Wed, Jun 02, 2004 at 03:13:48PM +0200, Verachten Bruno wrote:

Hi,

I've just generated a schema with elements like this one :
<xs:element name="origin">
<xs:complexType>
 <xs:simpleContent>
  <xs:extension base="xs:string">
   <xs:attribute ref="xml:lang" use="required"/>
  </xs:extension>
 </xs:simpleContent>
</xs:complexType>
</xs:element>

As you can see, there is an attribute-ref to the xml:lang attribute.
This attribute is not defined in the schema, and the IBM SchemaQualityChecker
doesn't see any error in the schema.

I'm trying to validate an XML document with this schema, and I get an error with xmllint :
$ xmllint --schema ../doc/translation.xsd --noout example12.xml
../doc/translation.xsd:22: element attribute: Schemas parser error : Schemas: attribute anonattr 9 
reference lang not found
../doc/translation.xsd:40: element attribute: Schemas parser error : Schemas: attribute anonattr 17 
reference lang not found
../doc/translation.xsd:30: element attribute: Schemas parser error : Schemas: attribute anonattr 13 
reference lang not found
WXS schema ../doc/translation.xsd failed to compile

Is there a problem with xmllint and the xml:lang attribute, or did I miss something?
$ xmllint --version
xmllint: using libxml version 20609
  compiled with: DTDValid FTP HTTP HTML C14N Catalog XPath XPointer XInclude Iconv Unicode Regexps 
Automata Schemas


  try with 2.6.10 first, and then double check the shemas specification,
I'm not sure you can actually use QNames to specify attributes names, you
may have to use the namespace explicitely, not the prefix.

First this won't work with the current version of libxml2, since the 
access of imported components is not complete. But the patch for this 
inconvinience is being (hopefully ;-)) reviewed by now.

Further, you have to explicitely import the schema for XML as done by 
the schema for schemas [1]:
<xs:import namespace="http://www.w3.org/XML/1998/namespace";
   schemaLocation="http://www.w3.org/2001/xml.xsd";>
But maby you already have, and it was just the "access of imported 
components" issue.

Additionally look at the definition for valid language values in libxml2 
[2]. This is somehow not consistent with the behaviour of e.g. Xerces, 
which validates with respect to the pattern 
"([a-zA-Z]{1,8})(-[a-zA-Z0-9]{1,8})*".

So, if you wait a day or two, you might get what you want.

[1] http://www.w3.org/TR/2004/PER-xmlschema-2-20040318/datatypes.html#schema

[2] 
http://www.xmlsoft.org/html/libxml-parserInternals.html#xmlCheckLanguageID


Regards,

Kasimier




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