You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ne...@apache.org on 2001/10/31 22:44:41 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/impl/xs/traversers XSDHandler.java
neilg 01/10/31 13:44:41
Modified: java/src/org/apache/xerces/impl/msg
XMLSchemaMessages.properties
java/src/org/apache/xerces/impl/xs/traversers
XSDHandler.java
Log:
add src-redefine.7.2.* constraints. Also add hooks for src-redefine.6.2.* constraints, though the checks themselves will have to wait until derivation-by-restriction constraints are implemented.
Revision Changes Path
1.27 +4 -1 xml-xerces/java/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
Index: XMLSchemaMessages.properties
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- XMLSchemaMessages.properties 2001/10/25 13:09:15 1.26
+++ XMLSchemaMessages.properties 2001/10/31 21:44:41 1.27
@@ -185,9 +185,12 @@
src-redefine.1 = src-redefine.1: the component ''{0}'' occurs in a schema different from that which was redefined.
src-redefine.5 = src-redefine.5: <simpleType> or <complexType> children of <redefine> elements must have <extension> or <restriction> descendants referring to themselves.
src-redefine = src-redefine: A <redefine> element cannot contain a child of type ''{0}''.
- src-redefine.6.1.1 = src-redefine.6.1.1: if a group child of a <redefine> element contains an group ref'ing itself, it must have exactly 1; this one has ''{0}''.
+ src-redefine.6.1.1 = src-redefine.6.1.1: if a group child of a <redefine> element contains a group ref'ing itself, it must have exactly 1; this one has ''{0}''.
src-redefine.6.1.2 = src-redefine.6.1.2: the group ''{0}'' which contains a reference to a group being redefined must have minOccurs = maxOccurs = 1.
+ src-redefine.6.2.1 = src-redefine.6.2.1: no group in the redefined schema with a name matching ''{0}''.
src-redefine.7.1 = src-redefine.7.1: if an attributeGroup child of a <redefine> element contains an attributeGroup ref'ing itself, it must have exactly 1; this one has ''{0}''.
+ src-redefine.7.2.1 = src-redefine.7.2.1: no attributeGroup in the redefined schema with a name matching ''{0}''.
+ src-redefine.7.2.2 = src-redefine.7.2.2: attributeGroup ''{0}'' does not properly restrict the attributeGroup it redefines; constraint violated: ''{1}''.
src-resolve = src-resolve: Cannot resolve the name ''{0}'' to a(n) {1} component.
src-resolve.4 = src-resolve.4: Components from namespace ''{1}'' are not referenceable from schema document ''{0}''.
src-restriction-base-or-simpleType = src-restriction-base-or-simpleType: error.
1.2 +43 -1 xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
Index: XSDHandler.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XSDHandler.java 2001/10/25 20:36:04 1.1
+++ XSDHandler.java 2001/10/31 21:44:41 1.2
@@ -107,7 +107,7 @@
* schema, other grammars may be constructed as a side-effect.
*
* @author Neil Graham, IBM
- * @version $Id: XSDHandler.java,v 1.1 2001/10/25 20:36:04 elena Exp $
+ * @version $Id: XSDHandler.java,v 1.2 2001/10/31 21:44:41 neilg Exp $
*/
public class XSDHandler {
@@ -859,6 +859,48 @@
return retObj;
} // getGlobalDecl(XSDocumentInfo, int, QName): Object
+
+ // This method determines whether there is a group
+ // (attributeGroup) which the given one has redefined by
+ // restriction. If so, it returns it; else it returns null.
+ // @param type: whether what's been redefined is an
+ // attributeGroup or a group;
+ // @param name: the QName of the component doing the redefining.
+ // @param currSchema: schema doc in which the redefining component lives.
+ // @return: Object representing decl redefined if present, null
+ // otherwise.
+ Object getGrpOrAttrGrpRedefinedByRestriction(int type, QName name, XSDocumentInfo currSchema) {
+ String realName = name.uri != null?name.uri+","+name.localpart:
+ ","+name.localpart;
+ String nameToFind = null;
+ switch (type) {
+ case ATTRIBUTEGROUP_TYPE:
+ nameToFind = (String)fRedefinedRestrictedAttributeGroupRegistry.get(realName);
+ break;
+ case GROUP_TYPE:
+ nameToFind = (String)fRedefinedRestrictedGroupRegistry.get(realName);
+ break;
+ default:
+ return null;
+ }
+ if (nameToFind == null) return null;
+ int commaPos = nameToFind.indexOf(",");
+ QName qNameToFind = new QName(EMPTY_STRING, nameToFind.substring(commaPos+1),
+ nameToFind.substring(commaPos), (commaPos == 0)? null : nameToFind.substring(0, commaPos));
+ Object retObj = getGlobalDecl(currSchema, type, qNameToFind);
+ if(retObj == null) {
+ switch (type) {
+ case ATTRIBUTEGROUP_TYPE:
+ reportSchemaError("src-redefine.7.2.1", new Object []{name.localpart});
+ break;
+ case GROUP_TYPE:
+ reportSchemaError("src-redefine.6.2.1", new Object []{name.localpart});
+ break;
+ }
+ return null;
+ }
+ return retObj;
+ } // getGrpOrAttrGrpRedefinedByRestriction(int, QName, XSDocumentInfo): Object
// Since ID constraints can occur in local elements, unless we
// wish to completely traverse all our DOM trees looking for ID
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org