Hi,
Please find attached patch for class XSDAttributeTraverser. Implemented
intersection of attribute wildcard.
Now, union of attribute uses is remaining. This cannot be implemented, as we are
still deciding how to perform union of attribute uses.
1.) The declarations
<attribute ref="GlobalAttr" use="required"/>
<attribute ref="GlobalAttr" use="optional"/>
are same, as both the attribute uses, refer attribute declaration having same
name and are from same tNS. So, it is an error if they appear together (3.6.6
clause 2). So, do we throw an exception or have just one attribute use. Which
one?. One with use="required" or the one with use="optional". In other words,
one that comes first or one that comes last?.
2.) The declarations
<attribute name="Attr1" type="ID"/>
<attribute name="Attr2" type="ID"/>
are different as they have different names. But, its an error, if they appear
together (3.6.6 clause 3). So, do we throw exception here, or reject one and
accept other?. If reject, which one?
If we throw exception, we do not solve our purpose of computing union. If we
accept one, we should have a rationale behind the choice. Any answers!!.
=:-)
Cheers,
Rahul.
Sun Microsystems, Inc.
Index: XSDAbstractTraverser.java
===================================================================
RCS file:
/home/cvspublic/xml-xerces/java/src/org/apache/xerces/impl/v2/XSDAbstractTraverser.java,v
retrieving revision 1.20
diff -u -w -r1.20 XSDAbstractTraverser.java
--- XSDAbstractTraverser.java 2001/09/25 22:46:07 1.20
+++ XSDAbstractTraverser.java 2001/10/02 14:31:41
@@ -73,6 +73,7 @@
* a unified way to initialize these data.
*
* @author Elena Litani, IBM
+ * @author Rahul Srivastava, Sun Microsystems Inc.
*
* @version $Id: XSDAbstractTraverser.java,v 1.20 2001/09/25 22:46:07 sandygao Exp $
*/
@@ -183,8 +184,18 @@
child, schemaDoc, grammar);
XSAttributeUse[] attrUseS = tempAttrGrp.getAttributeUses();
for (int i=0; i<attrUseS.length; i++) {
+ //REVISIT: perform union check before adding.
attrGrp.addAttributeUse(attrUseS[i]);
}
+
+ if (attrGrp.fAttributeWC == null) {
+ attrGrp.fAttributeWC = tempAttrGrp.fAttributeWC;
+ }
+ // perform intersection of attribute wildcard
+ else {
+ attrGrp.fAttributeWC = attrGrp.fAttributeWC.
+
+performIntersectionWith(tempAttrGrp.fAttributeWC);
+ }
}
else
break;
@@ -193,8 +204,16 @@
if (child != null) {
childName = child.getLocalName();
if (childName.equals(SchemaSymbols.ELT_ANYATTRIBUTE)) {
- XSWildcardDecl tempAttrWC =
fSchemaHandler.fWildCardTraverser.traverseAnyAttribute(child, schemaDoc, grammar);
+ XSWildcardDecl tempAttrWC = fSchemaHandler.fWildCardTraverser.
+ traverseAnyAttribute(child, schemaDoc,
+grammar);
+ if (attrGrp.fAttributeWC == null) {
attrGrp.fAttributeWC = tempAttrWC;
+ }
+ // perform intersection of attribute wildcard
+ else {
+ attrGrp.fAttributeWC = attrGrp.fAttributeWC.
+ performIntersectionWith(tempAttrWC);
+ }
child = DOMUtil.getNextSiblingElement(child);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]