I'm test driving the 12/17 Schema WD support and think I found a bug...

Specifying an attributeGroup reference in a type declaration causes an error if
at least one attribute isn't defined before it.  The error is: "Datatype
qualifiers can only be used if you specify a type attribute."  Although the
syntax changed, this should still be legal.

Using the sample DOMCount or SAXCount, the following short test files will
reproduce the problem.  A stack trace only shows up if you modify DOMCount or
SAXCount to print it (which I did and the trace is appended below).

george

-------------------------------------------------------------

<?xml version="1.0"?>
<!DOCTYPE schema PUBLIC "-//W3C//DTD XMLSCHEMA 19991216//EN"
        "http://www.w3.org/TR/1999/WD-xmlschema-1-19991217/structures.dtd";>
<schema>
  <attributeGroup name='group1'>
    <attribute name='name1' type='string'/>
  </attributeGroup>
  <element name='element2'>
    <type content='empty'>
      <attributeGroup ref='group1'/>   //ERROR ERROR ERROR
    </type>
  </element>
  <element name='element1'>
    <type content='elementOnly'>
      <element ref='element2'/>
      <attribute name='xmlns' type='string'/>
      <attributeGroup ref='group1'/>   //OK OK OK
    </type>
  </element>
</schema>


<?xml version="1.0" encoding="us-ascii"?>
<element1 xmlns='test.xsd'>
  <element2 name1='q'/>
</element1>


[Error] test.xml:2:27: Datatype qualifiers can only be used if you specify a
type attribute.
Datatype qualifiers can only be used if you specify a type attribute.
 at org.apache.xerces.framework.XMLParser.reportErrorXMLParser.java:1264)
 at org.apache.xerces.validators.schema.XSchemaValidator.reportSchemaError
XSchemaValidator.java:2907)
 at
org.apache.xerces.validators.schema.XSchemaValidator.traverseTypeDecl(XSchemaVal
idator.java:1932)
 at
org.apache.xerces.validators.schema.XSchemaValidator.traverseElementDecl(XSchema
Validator.java:2208)
 at
org.apache.xerces.validators.schema.XSchemaValidator.traverseSchema(XSchemaValid
ator.java:1731)
 at
org.apache.xerces.validators.schema.XSchemaValidator.loadSchema(XSchemaValidator
.java:1699)
 at org.apache.xerces.framework.XMLParser.scanAttValue(XMLParser.java:1952)
 at
org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanner.ja
va:1800)
 at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDoc
umentScanner.java:991)
 at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java
:381)
 at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1145)
 at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1184)
 at sax.SAXCount.print(SAXCount.java:135)
 at sax.SAXCount.main(SAXCount.java:332)
test.xml: 1100 ms (1 elems, 2 attrs, 0 spaces, 0 chars)


Reply via email to