You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by "George T. Joseph" <gt...@peakin.com> on 2000/01/30 19:59:40 UTC

Another couple of quick fixes for XSchemaValidator.java

Added the ability to specify <annotation>  in <element>, <group>, <attribute>,
and <attributeGroup>.  It was already allowed in <schema>, <datatype>,  and
<type>.  The patch I did earlier for <attributeGroup> is here as well.

george
------------------------------------------------------

*** XSchemaValidator.javabak	Fri Jan 28 19:27:00 2000
--- XSchemaValidator.java	Sun Jan 30 13:36:44 2000
***************
*** 1922,1928 ****
                      else // buildAll
                          reportSchemaError(SchemaMessageProvider.OrderIsAll,
                                            new Object [] { "group" } );
!                 } else if (childName.equals(ELT_ATTRIBUTEDECL)) {
                      break; // attr processing is done be    low
                  } else if (childName.equals(ELT_ANY)) {
                      contentSpecType = fStringPool.addSymbol("ANY");
--- 1922,1929 ----
                      else // buildAll
                          reportSchemaError(SchemaMessageProvider.OrderIsAll,
                                            new Object [] { "group" } );
!                 } else if (childName.equals(ELT_ATTRIBUTEDECL) ||
!                            childName.equals(ELT_ATTRGROUPDECL) ){
                      break; // attr processing is done be    low
                  } else if (childName.equals(ELT_ANY)) {
                      contentSpecType = fStringPool.addSymbol("ANY");
***************
*** 1998,2003 ****
--- 1999,2006 ----
  		}

  		Element child = XUtil.getFirstChildElement(groupDecl);
+       while (child != null && child.getNodeName().equals(ELT_ANNOTATION))
+          child = XUtil.getNextSiblingElement(child);

  		int contentSpecType = 0;
  		int csnType = 0;
***************
*** 2201,2206 ****
--- 2204,2211 ----

  		// element has a single child element, either a datatype or a type, null if
primitive
  		Element content = XUtil.getFirstChildElement(elementDecl);
+       while (content != null && content.getNodeName().equals(ELT_ANNOTATION))
+          content = XUtil.getNextSiblingElement(content);

  		if (content != null) {
  			String contentName = content.getNodeName();
***************
*** 2288,2295 ****
  		int attType = -1;
  		int enumeration = -1;
  		String datatype = attrDecl.getAttribute(ATT_TYPE);
  		if (datatype.equals("")) {
- 		    Element child = XUtil.getFirstChildElement(attrDecl);
  		    while (child != null && !child.getNodeName().equals(ELT_DATATYPEDECL))
  		        child = XUtil.getNextSiblingElement(child);
  		    if (child != null && child.getNodeName().equals(ELT_DATATYPEDECL)) {
--- 2293,2302 ----
  		int attType = -1;
  		int enumeration = -1;
  		String datatype = attrDecl.getAttribute(ATT_TYPE);
+       Element child = XUtil.getFirstChildElement(attrDecl);
+       while (child != null && child.getNodeName().equals(ELT_ANNOTATION))
+          child = XUtil.getNextSiblingElement(child);
  		if (datatype.equals("")) {
  		    while (child != null && !child.getNodeName().equals(ELT_DATATYPEDECL))
  		        child = XUtil.getNextSiblingElement(child);
  		    if (child != null && child.getNodeName().equals(ELT_DATATYPEDECL)) {
***************
*** 2390,2395 ****
--- 2397,2404 ----
  		}

  		Element child = XUtil.getFirstChildElement(attrGroupDecl);
+       while (child != null && child.getNodeName().equals(ELT_ANNOTATION))
+          child = XUtil.getNextSiblingElement(child);

  		int groupIndices[] = new int
[((org.apache.xerces.dom.NodeImpl)attrGroupDecl).getLength()];
  		int numGroups = 0;



Re: Another couple of quick fixes for XSchemaValidator.java

Posted by Ralf Pfeiffer <rp...@apache.org>.
Thanks George!
Your patches have been applied to CVS.
-rip

"George T. Joseph" wrote:

> Added the ability to specify <annotation>  in <element>, <group>, <attribute>,
> and <attributeGroup>.  It was already allowed in <schema>, <datatype>,  and
> <type>.  The patch I did earlier for <attributeGroup> is here as well.
>
> george
> ------------------------------------------------------
>
> *** XSchemaValidator.javabak    Fri Jan 28 19:27:00 2000
> --- XSchemaValidator.java       Sun Jan 30 13:36:44 2000
> ***************
> *** 1922,1928 ****
>                       else // buildAll
>                           reportSchemaError(SchemaMessageProvider.OrderIsAll,
>                                             new Object [] { "group" } );
> !                 } else if (childName.equals(ELT_ATTRIBUTEDECL)) {
>                       break; // attr processing is done be    low
>                   } else if (childName.equals(ELT_ANY)) {
>                       contentSpecType = fStringPool.addSymbol("ANY");
> --- 1922,1929 ----
>                       else // buildAll
>                           reportSchemaError(SchemaMessageProvider.OrderIsAll,
>                                             new Object [] { "group" } );
> !                 } else if (childName.equals(ELT_ATTRIBUTEDECL) ||
> !                            childName.equals(ELT_ATTRGROUPDECL) ){
>                       break; // attr processing is done be    low
>                   } else if (childName.equals(ELT_ANY)) {
>                       contentSpecType = fStringPool.addSymbol("ANY");
> ***************
> *** 1998,2003 ****
> --- 1999,2006 ----
>                 }
>
>                 Element child = XUtil.getFirstChildElement(groupDecl);
> +       while (child != null && child.getNodeName().equals(ELT_ANNOTATION))
> +          child = XUtil.getNextSiblingElement(child);
>
>                 int contentSpecType = 0;
>                 int csnType = 0;
> ***************
> *** 2201,2206 ****
> --- 2204,2211 ----
>
>                 // element has a single child element, either a datatype or a type, null if
> primitive
>                 Element content = XUtil.getFirstChildElement(elementDecl);
> +       while (content != null && content.getNodeName().equals(ELT_ANNOTATION))
> +          content = XUtil.getNextSiblingElement(content);
>
>                 if (content != null) {
>                         String contentName = content.getNodeName();
> ***************
> *** 2288,2295 ****
>                 int attType = -1;
>                 int enumeration = -1;
>                 String datatype = attrDecl.getAttribute(ATT_TYPE);
>                 if (datatype.equals("")) {
> -                   Element child = XUtil.getFirstChildElement(attrDecl);
>                     while (child != null && !child.getNodeName().equals(ELT_DATATYPEDECL))
>                         child = XUtil.getNextSiblingElement(child);
>                     if (child != null && child.getNodeName().equals(ELT_DATATYPEDECL)) {
> --- 2293,2302 ----
>                 int attType = -1;
>                 int enumeration = -1;
>                 String datatype = attrDecl.getAttribute(ATT_TYPE);
> +       Element child = XUtil.getFirstChildElement(attrDecl);
> +       while (child != null && child.getNodeName().equals(ELT_ANNOTATION))
> +          child = XUtil.getNextSiblingElement(child);
>                 if (datatype.equals("")) {
>                     while (child != null && !child.getNodeName().equals(ELT_DATATYPEDECL))
>                         child = XUtil.getNextSiblingElement(child);
>                     if (child != null && child.getNodeName().equals(ELT_DATATYPEDECL)) {
> ***************
> *** 2390,2395 ****
> --- 2397,2404 ----
>                 }
>
>                 Element child = XUtil.getFirstChildElement(attrGroupDecl);
> +       while (child != null && child.getNodeName().equals(ELT_ANNOTATION))
> +          child = XUtil.getNextSiblingElement(child);
>
>                 int groupIndices[] = new int
> [((org.apache.xerces.dom.NodeImpl)attrGroupDecl).getLength()];
>                 int numGroups = 0;