You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by "Hollenbeck, Scott" <sh...@netsol.com> on 2000/08/14 20:25:06 UTC

xml:lang Attribute

Sorry if this is a FAQ or something; the archives appear to be inaccessible
at the moment.

I seem to be unable to get Xerces Java to recognize a declaration for the
xml:lang attribute.  Am I doing something wrong, or have I hit a known
issue?  Here's the relevant sections of my schema:

<schema xmlns="http://www.w3.org/1999/XMLSchema"
        xmlns:xml="http://www.w3.org/TR/REC-xml"
        xmlns:epp="http://www.NSIRegistry.net/FOO"
        targetNamespace="http://www.NSIRegistry.net/FOO"
        elementFormDefault="qualified">

  <element name="response-text" type="epp:clientTextType" maxLength="80"/>
  <complexType name="clientTextType" content="textOnly">
    <attribute name="xml:lang" type="string" default="en-US"/>
  </complexType>

</schema>

here's the element from the XML instance:

<response-text xml:lang="en-US" >This is text</response-text>

and here's the error I get:

[Error] example.xml:15:54: Attribute "xml:lang" must be declared for element
type "response-text".

What have I done wrong?

Scott Hollenbeck
Network Solutions, Inc. Registry

Re: xml:lang Attribute

Posted by Andy Clark <an...@apache.org>.
Eric Ye wrote:
> It is really sticky to use attribute "xml:lang" , or any attribute 
> with reserved prfix "xml:", with Schema validation. The mean reason 
> is prefix "xml:" is always bound to  a specially reserved namespace 
> URI "http://www.w3.org/XML/1998/namespace", however there is no 
> special Schema with the same targetNameSpace as such. Maybe we 
> should raise this issue to W3C schema working group.

Another option is that we special case the "xml:lang" and
"xml:space" attributes so that we don't run into this problem
while it is clarified by the working group.

-- 
Andy Clark * IBM, JTC - Silicon Valley * andyc@apache.org

Re: xml:lang Attribute

Posted by Eric Ye <er...@locus.apache.org>.
It is really sticky to use attribute "xml:lang" , or any attribute with
reserved prfix "xml:", with Schema validation. The mean reason is prefix
"xml:" is always bound to  a specially reserved namespace URI
"http://www.w3.org/XML/1998/namespace", however there is no special Schema
with the same targetNameSpace as such. Maybe we should raise this issue to
W3C schema working group.

For now, I suggest you not use "xml:lang" with Schema validation, instead,
since the sole purpose of "xml:lang" is to facilitate the application to
identify the language in which the document is written, you can define you
own 'ad hoc' attribute to carry such information.

Schema also defined a simple type named "language" , which basically is the
counterpart of LanguageID in XML 1.0 Rec.   You can "type" your attribute as
"language" type in order to get it validated.
_____


Eric Ye * IBM, JTC - Silicon Valley * ericye@locus.apache.org

----- Original Message -----
From: "Hollenbeck, Scott" <sh...@netsol.com>
To: <ge...@xml.apache.org>
Cc: "Hollenbeck, Scott" <sh...@netsol.com>
Sent: Monday, August 14, 2000 11:25 AM
Subject: xml:lang Attribute


> Sorry if this is a FAQ or something; the archives appear to be
inaccessible
> at the moment.
>
> I seem to be unable to get Xerces Java to recognize a declaration for the
> xml:lang attribute.  Am I doing something wrong, or have I hit a known
> issue?  Here's the relevant sections of my schema:
>
> <schema xmlns="http://www.w3.org/1999/XMLSchema"
>         xmlns:xml="http://www.w3.org/TR/REC-xml"
>         xmlns:epp="http://www.NSIRegistry.net/FOO"
>         targetNamespace="http://www.NSIRegistry.net/FOO"
>         elementFormDefault="qualified">
>
>   <element name="response-text" type="epp:clientTextType" maxLength="80"/>
>   <complexType name="clientTextType" content="textOnly">
>     <attribute name="xml:lang" type="string" default="en-US"/>
>   </complexType>
>
> </schema>
>
> here's the element from the XML instance:
>
> <response-text xml:lang="en-US" >This is text</response-text>
>
> and here's the error I get:
>
> [Error] example.xml:15:54: Attribute "xml:lang" must be declared for
element
> type "response-text".
>
> What have I done wrong?
>
> Scott Hollenbeck
> Network Solutions, Inc. Registry
>
> ---------------------------------------------------------------------
> In case of troubles, e-mail:     webmaster@xml.apache.org
> To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
> For additional commands, e-mail: general-help@xml.apache.org
>
>