For the 2nd point in Jeff's example, if the explanation is the parser does
not know foo is in default namespace, how come the following example works?
Instance document:
<?xml version="1.0" ?>
<message xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
           xmlns="blahblahblah"
        date='2001-07-13'
        id="something"
     xsi:schemaLocation='blahblahblah schemas/nsmail.xsd' />
nsmail.xsd file:
<?xml version="1.0" ?>
<schema xmlns='http://www.w3.org/2001/XMLSchema'
     xmlns:nsm="blahblahblah"
     targetNamespace="blahblahblah"
     elementFormDefault="qualified">
<element name="message" type="nsm:email" />
<complexType name="email" >
  <attribute name="id" type="string" use="required"/>
  <attribute name="date" type="date" use="required"/>
</complexType>
</schema>

In this case, the parser had no problem validating date and id!
Does that mean if an attribute is defined within an element, it belongs to
no namespace, but if it is defined globally, it belongs to the target
namespace?
Could someone please confirm?




Sandy Gao/Toronto/[EMAIL PROTECTED] on 08/20/2001 08:38:32 AM

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:
Subject:  Re: Attribute References and Groups



Hi Jeff,

Thanks for your input.

(1) Indirect Circular attributeGroup reference

As you found out, this is a bug of the spec, not Xerces :-) I have a fix
for this, but we are working on 1.4.3 release at the same time. So I'm not
sure whether this fix will be in 1.4.3.

(2) Attribute Ref doesn't work?

Since default namespace doesn't apply to attributes (from the namespace
spec), you need to specify namespace for attribute "foo" explicitly:

<root xmlns="http://www.example.com";
      xmlns:myns="http://www.example.com";
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
      xsi:schemaLocation="http://www.example.com att.xsd"
      myns:foo="test"/>

Cheers,
Sandy Gao
Software Developer, IBM Canada
(1-416) 448-3255
[EMAIL PROTECTED]




                    [EMAIL PROTECTED]
                    thlink.net           To:
<[EMAIL PROTECTED]>
                                         cc:
                    08/17/2001           Subject:     Attribute References
and Groups
                    12:40 AM
                    Please respond
                    to
                    xerces-j-user





I have been using Xerces like mad lately and it is great!-- I ran across
what appear to be a couple of bugs-- hopefully someone can confirm:

(1) Indirect Circular attributeGroup reference

att.XML
======
<?xml version="1.0"?>
<root xmlns="http://www.example.com";
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
      xsi:schemaLocation="http://www.example.com att.xsd"/>

att.XSD
======
<?xml version="1.0"?>
<schema
  xmlns="http://www.w3.org/2001/XMLSchema";
  xmlns:target="http://www.example.com";
  targetNamespace="http://www.example.com";
  elementFormDefault="qualified">
  <!-- Indirect circular reference -->
  <attributeGroup name="AttGroup1">
    <attributeGroup ref="target:AttGroup2"/>
  </attributeGroup>
  <attributeGroup name="AttGroup2">
    <attributeGroup ref="target:AttGroup1"/>
  </attributeGroup>

  <element name="root">
    <complexType>
      <attributeGroup ref="target:AttGroup1"/>
    </complexType>
  </element>
</schema>

===
The src for attributeGroup representation point 3 does not disallow
indirect
resolution per se-- but it should be implied. It looks as though the parser
is trying to use the declaration when it should raise an error. It
correctly
raises an error when the attributeGroup refers to itself. [1]

(2) Attribute Ref doesn't work?

att2.XML
=======

<?xml version="1.0"?>
<root xmlns="http://www.example.com";
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
      xsi:schemaLocation="http://www.example.com att.xsd"
      foo="test"/>

att2.XSD
=======
<?xml version="1.0"?>
<schema
  xmlns="http://www.w3.org/2001/XMLSchema";
  xmlns:target="http://www.example.com";
  targetNamespace="http://www.example.com";
  elementFormDefault="qualified">
  <!-- Indirect circular reference -->
  <attribute name="foo" type="string"/>
  <element name="root">
    <complexType>
      <attribute ref="target:foo"/>
    </complexType>
  </element>
</schema>

Error
====
[Error] Attribute "foo" must be declared for element type "root". line 5
column 19 - att2.xml

Foo is declared-- it uses the ref model to utilize the global declaration.

[1]
http://www.w3.org/TR/xmlschema-1/#section-Constraints-on-XML-Representations


-of-Attribute-Group-Definitions

These aren't causing huge problems for me right now, but they may affect
someone down the road...

Thanks again!
Jeff Rafter
Defined Systems
http://www.defined.net
XML Development and Developer Web Hosting



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



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





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

Reply via email to