DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5158>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5158

xml:lang error when using namespace

           Summary: xml:lang error when using namespace
           Product: Xerces-J
           Version: CVS extract
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Samples
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Dear All,

I'm trying to use xml:lang namespace, but got the following error:

[Error] test.xml:38:25: cvc-complex-type.3.2.2: Attrib
ute 'xml:lang' is not valid respect to the attribute wildcard of 
Elment 'FreeTexst'.

I have looked at bug report http://nagoya.apache.org/bugzilla/show_bug.cgi?
id=3937 and be able to run that sample files. However, I still can't
figure out what is wrong with my test file.  Can anyone help?
I'm enclosing the .xsd and .xml at the bottom (since don't know
how to use attachment on this).

Thanks!

--Wo

--------------- test.xsd ---------------
<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="urn:mpeg:mpeg7:schema:2001" 
   xmlns="http://www.w3.org/2001/XMLSchema"; 
   xmlns:xml="http://www.w3.org/XML/1998/namespace"; 
   xmlns:mpeg7="urn:mpeg:mpeg7:schema:2001" 
     elementFormDefault="qualified" attributeFormDefault="unqualified">

        <import namespace="http://www.w3.org/XML/1998/namespace"; 
            schemaLocation="xml-1998.xsd"/>

        <element name="Root">
                <complexType>
                        <sequence>
                                <element name="FreeText" 
type="mpeg7:TextualType" minOccurs="0" maxOccurs="unbounded"/>
                        </sequence>
                </complexType>
        </element>

        <complexType name="TextualBaseType" abstract="true">
                <simpleContent>
                        <extension base="string">
                                <attribute ref="xml:lang" use="optional"/>
                                <!-- omitted for simplicity
                                <attribute name="phoneticTranscription" 
use="optional">
                                        <simpleType>
                                                <list 
itemType="mpeg7:PhoneType"/>
                                        </simpleType>
                                </attribute>
                                <attribute name="phoneticAlphabet" 
type="mpeg7:phoneticAlphabetType" use="optional" default="sampa"/>
                                -->
                        </extension>
                </simpleContent>
        </complexType>
        <!-- Definition of Textual datatype -->
        <complexType name="TextualType">
                <simpleContent>
                        <extension base="mpeg7:TextualBaseType"/>
                </simpleContent>
        </complexType>
</schema>

------------ xml-1998.xsd -----------
<?xml version="1.0"?>
<schema targetNamespace="http://www.w3.org/XML/1998/namespace";
        xmlns="http://www.w3.org/2001/XMLSchema";
        xmlns:x="http://www.w3.org/XML/1998/namespace";>
        <annotation>
                <documentation>This schema defines attributes and an attribute 
group
        suitable for use by
        schemas wishing to allow xml:lang or xml:space attributes
        on elements they define.

        To enable this, such a schema must first declare the XML
        namespace, and then import this schema
        for the XML namespace, e.g. as follows:
        &lt;schema . . . xmlns:xml="http://www.w3.org/XML/1998/namespace";>
         . . .
         &lt;import namespace="http://www.w3.org/XML/1998/namespace";
                    schemaLocation="http://www.w3.org/XML/2000/10/xml.xsd"/>

        Subsequently, qualified reference to either of the attributes
        or the group defined below will have the desired effect, e.g.

        &lt;type . . .>
         . . .
         &lt;attributeGroup ref="xml:specialAttrs"/>
 
         will define a type which will schema-validate a instance
         element with both xml:space and xml:lang attribute</documentation>
        </annotation>
        <attribute name="lang" type="language">
                <annotation>
                        <documentation>In due course, we should install the 
relevant ISO 2- and 3-letter
         codes as the enumerated possible values . . .</documentation>
                </annotation>
        </attribute>
        <attribute name="space" default="preserve">
                <simpleType>
                        <restriction base="NCName">
                                <enumeration value="default"/>
                                <enumeration value="preserve"/>
                        </restriction>
                </simpleType>
        </attribute>
        <attributeGroup name="specialAttrs">
                <attribute ref="x:lang"/>
                <attribute ref="x:space"/>
        </attributeGroup>
</schema>

------------ test.xml ---------------
<?xml version="1.0" encoding="iso-8859-1"?>
<Root xmlns="urn:mpeg:mpeg7:schema:2001" 
      xmlns:mpeg7="urn:mpeg:mpeg7:schema:2001" 
      xmlns:xml="http://www.w3.org/XML/1998/namespace"; 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
      xsi:schemaLocation="urn:mpeg:mpeg7:schema:2001 test.xsd">
        <FreeText xml:lang="us">Hello world!!</FreeText>
        <FreeText xml:lang="jp">Sekai yo Kon-nichiwa!!</FreeText>
</Root>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to