Hi Pavani,
First, I should let you--and everybody else who's interested--know that
Sandy will be on holiday until Oct. 15. So responses to all your patches
might be a little slower than heretofore... :-(
Anyway, some comments on your patch for XSDAbstractTraverser:
1. I don't know if you noticed, but traverseAnnotation(...) already checks
the attributes of the annotation element. Therefore checkContent should not
do so; if this were to happen, we'd risk running into false detections of
multiple ID attributes with the same value.
2. checkContent is only useful in cases where s are required to occur as
the first component in a declaration. Since this is not true with elements,
checkContent cannot be called during traversal and so will only ever be
called in a local context. Hence the checks for globalness can be removed.
3. I don't know how much you've looked into our error-reporting
infrastructure, but before he went on holiday Sandy spent a good bit of
time on this. Hence my feeling is that, whenever possible, we should use
this infrastructure and throw real errors rather than putting lots of
revisits in our code.
So if you can make these changes--or have some other ideas :-)--I'll be
happy to commit this for you.
Cheers,
Neil
Neil Graham
XML Parser Development
IBM Toronto Lab
Phone: 905-413-3519, T/L 969-3519
E-mail: [EMAIL PROTECTED]
Pavani Mukthipudi <[EMAIL PROTECTED]> on 09/27/2001 09:58:13 AM
Please respond to [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
cc:
Subject: code for checkContent() of XSDAbstractTraverser
Please find the attached diff for XSDAbstractTraverser
Pavani
--
Pavani Mukthipudi
Sun Microsystems Inc.
Phone: 080 - 2298989 Extn: 87390
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 -r1.20 XSDAbstractTraverser.java
--- XSDAbstractTraverser.java 2001/09/25 22:46:07 1.20
+++ XSDAbstractTraverser.java 2001/09/27 13:51:14
@@ -232,13 +232,42 @@
// false if must have some element (with possible
preceding <annotation?>)
//
- //REVISIT: Implement
//REVISIT: if we want to expose annotation information to the
application,
// then we should never call this method. different traversers
// should call traverseAnnotationDecl() directly, and store
the
// returned value.
Element checkContent( Element elm, Element content, boolean isEmpty )
{
- return content;
+
+ if (content == null) {
+ return content;
+ }
+
+ if (content.getLocalName().equals(SchemaSymbols.ELT_ANNOTATION)) {
+ Document doc = DOMUtil.getDocument(content);
+ XSDocumentInfo docInfo =
fSchemaHandler.fDoc2XSDocumentMap(doc);
+ boolean isGlobal = false;
+
+ if (DOMUtil.getParent(elm).getLocalName
().equals(SchemaSymbols.ELT_SCHEMA))
+ isGlobal = true;
+
+ Object[] parentAttrs = fAttrChecker.checkAttributes(elm,
isGlobal, docInfo);
+
+ traverseAnnotationDecl(content, parentAttrs, false, docInfo);
+
+ fAttrChecker.returnAttrArray(parentAttrs, docInfo);
+ content = DOMUtil.getNextSiblingElement(content);
+
+ // REVISIT : should we make these checks here ??
+
+ if (content == null && !isEmpty) {
+ // report error
+ }
+ else if (content != null && isEmpty) {
+ // report error
+ }
+ }
+
+ return content;
}
/**
---------------------------------------------------------------------
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]