You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mu...@apache.org on 2013/06/16 05:51:59 UTC
svn commit: r1493456 - in
/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl:
msg/XMLSchemaMessages.properties xs/traversers/XSDAbstractTraverser.java
Author: mukulg
Date: Sun Jun 16 03:51:58 2013
New Revision: 1493456
URL: http://svn.apache.org/r1493456
Log:
committing fix for jira issue XERCESJ-1615
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties?rev=1493456&r1=1493455&r2=1493456&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties Sun Jun 16 03:51:58 2013
@@ -137,6 +137,7 @@
src-ct.4 = src-ct.4: Complex Type Definition Representation Error for type ''{0}''. The intersection of wildcards is not expressible.
src-ct.5 = src-ct.5: Complex Type Definition Representation Error for type ''{0}''. The union of wildcards is not expressible.
src-ct.6 = src-ct.5: Complex Type Definition Representation Error for type ''{0}''. If <openContent> is present and the actual value of its mode [attribute] is not 'none', then there must be an <any> among the [children] of <openContent>.
+ src-ct.7 = src-ct.7: Attribute group ''{0}'' is declared more than once within a complex type definition ''{1}''.
src-ct11.3 = src-ct11.3: Complex Type Definition Representation Error for type ''{0}''. If <openContent> is present and has mode = 'none', then there must not be an <any> among the [children] of <openContent>.
src-ct11.4 = src-ct11.4: Complex Type Definition Representation Error for type ''{0}''. If the <complexContent> alternative is chosen and the 'mixed' attribute is present on both <complexType> and <complexContent>, then the actual values of those attributes must be the same.
src-element.1 = src-element.1: The properties ''default'' and ''fixed'' cannot both be present in element declaration ''{0}''. Use only one of them.
@@ -372,4 +373,4 @@
jaxp12-schema-source-type.1 = The ''http://java.sun.com/xml/jaxp/properties/schemaSource'' property cannot have a value of type ''{0}''. Possible types of the value supported are String, File, InputStream, InputSource or an array of these types.
jaxp12-schema-source-type.2 = The ''http://java.sun.com/xml/jaxp/properties/schemaSource'' property cannot have an array value of type ''{0}''. Possible types of the array supported are Object, String, File, InputStream and InputSource.
jaxp12-schema-source-ns = When using an array of Objects as the value of the 'http://java.sun.com/xml/jaxp/properties/schemaSource' property, it is illegal to have two schemas that share the same target namespace.
-
+
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java?rev=1493456&r1=1493455&r2=1493456&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java Sun Jun 16 03:51:58 2013
@@ -17,7 +17,11 @@
package org.apache.xerces.impl.xs.traversers;
+import java.util.HashMap;
+import java.util.Iterator;
import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
import java.util.Vector;
import org.apache.xerces.impl.Constants;
@@ -37,8 +41,8 @@ import org.apache.xerces.impl.xs.XSWildc
import org.apache.xerces.impl.xs.assertion.Test;
import org.apache.xerces.impl.xs.assertion.XSAssertImpl;
import org.apache.xerces.impl.xs.util.XInt;
-import org.apache.xerces.impl.xs.util.XSObjectListImpl;
import org.apache.xerces.impl.xs.util.XS11TypeHelper;
+import org.apache.xerces.impl.xs.util.XSObjectListImpl;
import org.apache.xerces.util.DOMUtil;
import org.apache.xerces.util.NamespaceSupport;
import org.apache.xerces.util.SymbolTable;
@@ -789,6 +793,7 @@ abstract class XSDAbstractTraverser {
XSAttributeUseImpl tempAttrUse = null;
XSAttributeUse otherUse = null;
String childName;
+ Map attrGroupCounts = new HashMap();
for (child=firstAttr; child!=null; child=DOMUtil.getNextSiblingElement(child)) {
childName = DOMUtil.getLocalName(child);
@@ -826,6 +831,7 @@ abstract class XSDAbstractTraverser {
//REVISIT: do we need to save some state at this point??
tempAttrGrp = fSchemaHandler.fAttributeGroupTraverser.traverseLocal(
child, schemaDoc, grammar);
+ setAttributeGroupCount(attrGroupCounts, tempAttrGrp.getName(), tempAttrGrp.getNamespace());
if(tempAttrGrp == null ) continue;
XSObjectList attrUseS = tempAttrGrp.getAttributeUses();
XSAttributeUseImpl oneAttrUse;
@@ -877,6 +883,16 @@ abstract class XSDAbstractTraverser {
break;
} // for
+ // check if any <attributeGroup> QName occurs more than once. display a warning for each such occurrence.
+ Set keySet = attrGroupCounts.keySet();
+ for (Iterator iter = keySet.iterator(); iter.hasNext();) {
+ QName qname = (QName)iter.next();
+ Integer count = (Integer)attrGroupCounts.get(qname);
+ if (count.intValue() > 1) {
+ reportSchemaWarning("src-ct.7", new Object[]{qname.localpart, enclosingParent.getName()}, (Element)firstAttr.getParentNode());
+ }
+ }
+
if (child != null) {
childName = DOMUtil.getLocalName(child);
if (childName.equals(SchemaSymbols.ELT_ANYATTRIBUTE)) {
@@ -903,11 +919,29 @@ abstract class XSDAbstractTraverser {
return child;
}
-
+
+ /*
+ * Store the count of <attributeGroup> keyed by its QName, encountered within a complex type definition.
+ */
+ private void setAttributeGroupCount(Map attrGroupCounts, String name, String namespace) {
+ QName qName = new QName(null, name, name, namespace);
+ if (attrGroupCounts.containsKey(qName)) {
+ Integer count = (Integer)attrGroupCounts.get(qName);
+ attrGroupCounts.put(qName, new Integer(count.intValue() + 1));
+ }
+ else {
+ attrGroupCounts.put(qName, new Integer(1));
+ }
+ }
+
void reportSchemaError (String key, Object[] args, Element ele) {
fSchemaHandler.reportSchemaError(key, args, ele);
}
+ void reportSchemaWarning (String key, Object[] args, Element ele) {
+ fSchemaHandler.reportSchemaWarning(key, args, ele);
+ }
+
/**
* Element/Attribute traversers call this method to check whether
* the type is NOTATION without enumeration facet
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org