Re: New article published: xml:lang in XML document schemas

Felix Sasaki scripsit:

> The benefit concerns validation again. A non validating XML processor (non  
> validating in the sense of the conformance section in the xml spec.)  
> accepts the attributes in the xml namespace, without validating them. In  
> XML Schema, you are *forced* to validate them. Im wondering if it is  
> *possible* in RELAX NG to validate them?

Of course.

A RELAX NG validator accepts two arguments, a document to validate and a schema
to validate the document against.  The schema may be composed from multiple
pieces, but there is no requirement that the pieces be organized according
to namespace, nor is there any sense in which a particular namespace implies
a particular schema.  That being so, you may declare attributes in the xml
namespace however you like.

> This discussion is getting more and more a non i18n issue, so now just one  
> more argument which makes it possibly i18n relevant again. xml:lang is  
> defined in terms of RFC 3066, which encompasses two language subtags: for  
> language and for country codes. Suppose you want to put additional  
> constraints on the value of xml:lang, so that it allows only for a subset  
> of rfc 3066 values (e. g. only language codes, but not country codes).  

Note for the record that RFC 3066 and its predecessor RFC 1766 have always
allowed more complex language tags than that, provided that they are
registered with IANA.  Furthermore, RFC 3066 is now obsolete, though the
replacement RFC has not yet been published by the RFC Editor.  A wealth of
new and more complex tags is therefore available when useful.

> With XML Schema it is no problem, but would you  be able to do that with  
> RELAX NG? It would not be possibly with DTDs.

Certainly.  It requires only that xml:lang be declared within the RELAX NG
schema relative to the document as having the pattern /[A-Za-z][A-Za-z]/.
(Technically this works only with RELAX NG validators that accept XML Schema
part 2 datatypes, but that is most of them.)

-- 
John Cowan  jcowan@reutershealth.com  www.ccil.org/~cowan  www.reutershealth.com
If I have seen farther than others, it is because I am surrounded by dwarves.
        --Murray Gell-Mann

Received on Friday, 25 November 2005 07:09:58 UTC