You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by je...@earthlink.net on 2001/08/17 06:40:33 UTC

Attribute References and Groups

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: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org