Re: [xml] xml:lang iso639-2 / rfc3066 / rfc 1766 obsolete



On Thu, Dec 13, 2007 at 03:12:30PM +0100, Friedbert Wekerle wrote:
Dear Daniel,

  please keep discussion on list !

thank You for your immediate response.

I'm processing extern-data. In this data 
the attribute xml:lang is often used; 
before importing these data into our database,
I check them with Your appreciated tool
libxml via perl (linux).

libxml incriminates the value "grc" of the attribute "xml:lang":

"...lang': 'grc' is not a valid value of the local union
type."

It does not incriminate the value "en".

As a simplified xsd/xml You can see that behavior
with the following example:

a.xsd
=============================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
<xs:import namespace="http://www.w3.org/XML/1998/namespace"; 
schemaLocation="http://www.w3.org/2001/xml.xsd"/>

<xs:attributeGroup name="i18n">
  <xs:attribute ref="xml:lang"/>
</xs:attributeGroup>

<xs:complexType name="A">
  <xs:sequence>
    <xs:element name="P" type="xs:string"/>
  </xs:sequence>
  <xs:attributeGroup ref="i18n"/>
</xs:complexType>

<xs:element name="A"/>

</xs:schema>
=============================================================

  You are using a Schemas, that wasn't explicitely stated in the
initial report (see http://xmlsoft.org/bugs.html I have no cristal ball!)
a.xml
=============================================================
<?xml version="1.0" encoding="ISO-8859-1" ?>
<A xml:lang="grc">
  <P>xxx</P>
</A>
=============================================================

then: (linux or win):libxml2-2.6.30.win32\bin\xmllint -noout --schema a.xsd a.xml
produces the errormessage.

My question was: how can I treat xmllint/libxml tolerating "grc" as an
valid attributValue of "xml:lang"?

  Your schemas use http://www.w3.org/2001/xml.xsd , which in turn uses
xs:language which uses to reference [RFC 1766] and now references [RFC 3066] 
  In XML-1.0 we dropped any test of the values of xml:lang because in practice
this didn't worked well (because the set changes and this does not change 
the resulting data being provided to the application)

  I can't say I will have time to update the libxml2 XSD datatype to 
reflect the new RFC reference, if someone wants to do it, go ahead !

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/



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