You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by sa...@ca.ibm.com on 2001/09/26 19:43:24 UTC

Re: code for SubstitutionGroupHandler (and XSAttributeGroupDecl)

Hi Rahul,

Thanks for your patches. Some comments before we could commit you patches:

XSAttributeGroupDecl:

It's not yet decided how to handle duplicate attribute uses: whether in the
traverser, or in the decl. And depending on the situation, some duplicated
attribute uses indicate an error, while others don't. Lisa's working on
this aspect. She might get back to you later.


SubstitutionGroupHandler:

1. getSubstitutionGroup():

According to the spec, the definition of a substitution group
(http://www.w3.org/TR/xmlschema-1/#cos-equiv-class), there are 3 aspects
that you need to modify for this method:

a. Include the element itself in the returned set;
b. Transitively find other elements. For example, A substitutes B, and B
substitutes C, then both A and B are in the substitution group of C;
c. Since all element/attribute names and namespaces are added into the same
symbol table, you should use == to compare two strings, instead of
String.equals().

In the Grammar class of Xerces1, there was code for getting the
substitution group of a given element. You can refer to that if you like.

2. checkSubstitutionGroupOK()

a. You don't need to access the XSDocumentInfo. The default block value is
already reflected in XSElementDecl.fBlock, if "block" attribute is not
specified on the element declaration.
b. The spec requires to check whether the type of "element" is validly
derived from that of "element.fSubGroup". Such checking is not as simple as
type1.base == type2. As you can see from "Type derivation OK
(simple/complex)", the checking is quite complicated. I've implemented such
derivation checking in XSConstraints. You can simply call
"checkTypeDerivationOk()".

In fact, since "checkTypeDerivationOk()" is already implemented, we don't
need to this "checkSubstitutionGroupOk()" method, because it's content
would simply be a call to "checktypeDerivationOk()". I'll modify
ElementTraverser to call "checktypeDerivationOk()" directly.

Cheers,
Sandy Gao
Software Developer, IBM Canada
(1-905) 413-3255
sandygao@ca.ibm.com


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org