You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by aj...@apache.org on 2007/05/22 07:31:52 UTC
svn commit: r540425 - in /webservices/commons/trunk/modules/XmlSchema/src:
main/java/org/apache/ws/commons/schema/ test/java/tests/
Author: ajith
Date: Mon May 21 22:31:51 2007
New Revision: 540425
URL: http://svn.apache.org/viewvc?view=rev&rev=540425
Log:
1. fixed Jira issue 205 (https://issues.apache.org/jira/browse/WSCOMMONS-205)
I. changed the string name attribute to qname
II. fixed serializers and deserializers
III. modified the test cases slightly to accomodate the change
Modified:
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttributeGroup.java
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaGroup.java
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java
webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AttributeGroupTest.java
webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/GroupTest.java
webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/RedefineTest.java
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java?view=diff&rev=540425&r1=540424&r2=540425
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java Mon May 21 22:31:51 2007
@@ -175,13 +175,13 @@
} else if (el.getLocalName().equals("group")) {
XmlSchemaGroup group = handleGroup(schema, el, schemaEl);
schema.groups.collection.put(
- new QName(schema.getTargetNamespace(), group.name), group);
+ group.name, group);
schema.items.add(group);
} else if (el.getLocalName().equals("attributeGroup")) {
XmlSchemaAttributeGroup group = handleAttributeGroup(schema,
el, schemaEl);
schema.attributeGroups.collection.put(
- new QName(schema.getTargetNamespace(), group.name), group);
+ group.name, group);
schema.items.add(group);
} else if (el.getLocalName().equals("attribute")) {
XmlSchemaAttribute attr = handleAttribute(schema,
@@ -1044,7 +1044,7 @@
Element schemaEl) {
XmlSchemaGroup group = new XmlSchemaGroup();
- group.name = groupEl.getAttribute("name");
+ group.name = new QName(schema.getTargetNamespace(),groupEl.getAttribute("name"));
for (Element el = XDOMUtil.getFirstChildElementNS(groupEl,
XmlSchema.SCHEMA_NS);
@@ -1073,7 +1073,8 @@
new XmlSchemaAttributeGroup();
if (groupEl.hasAttribute("name"))
- attrGroup.name = groupEl.getAttribute("name");
+ attrGroup.name = new QName(schema.getTargetNamespace(),
+ groupEl.getAttribute("name"));
if (groupEl.hasAttribute("id"))
attrGroup.id = groupEl.getAttribute("id");
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttributeGroup.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttributeGroup.java?view=diff&rev=540425&r1=540424&r2=540425
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttributeGroup.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttributeGroup.java Mon May 21 22:31:51 2007
@@ -16,6 +16,8 @@
package org.apache.ws.commons.schema;
+import javax.xml.namespace.QName;
+
/**
* Class for attribute groups. Groups a set of attribute declarations
* so that they can be incorporated as a group into complex type
@@ -52,13 +54,13 @@
this.attributes = attributes;
}
- String name;
+ QName name;
- public String getName() {
+ public QName getName() {
return this.name;
}
- public void setName(String name) {
+ public void setName(QName name) {
this.name = name;
}
}
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaGroup.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaGroup.java?view=diff&rev=540425&r1=540424&r2=540425
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaGroup.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaGroup.java Mon May 21 22:31:51 2007
@@ -16,6 +16,8 @@
package org.apache.ws.commons.schema;
+import javax.xml.namespace.QName;
+
/**
* Class that defines groups at the schema level that are referenced
* from the complex types. Groups a set of element declarations so that
@@ -31,14 +33,14 @@
public XmlSchemaGroup() {
}
- String name;
+ QName name;
XmlSchemaGroupBase particle;
- public String getName() {
+ public QName getName() {
return name;
}
- public void setName(String name) {
+ public void setName(QName name) {
this.name = name;
}
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java?view=diff&rev=540425&r1=540424&r2=540425
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java Mon May 21 22:31:51 2007
@@ -1521,8 +1521,9 @@
schema.schema_ns_prefix, XmlSchema.SCHEMA_NS);
if (groupObj.name != null) {
- if (groupObj.name.length() > 0) {
- group.setAttribute("name", groupObj.name);
+ String grpName = groupObj.name.getLocalPart();
+ if (grpName.length() > 0) {
+ group.setAttribute("name", grpName);
}
} else
throw new XmlSchemaSerializerException("Group must have " +
@@ -2516,10 +2517,11 @@
Element attributeGroup = createNewElement(doc, "attributeGroup",
schema.schema_ns_prefix, XmlSchema.SCHEMA_NS);
- if (attributeGroupObj.name != null)
+ if (attributeGroupObj.name != null) {
+ String attGroupName = attributeGroupObj.name.getLocalPart();
attributeGroup.setAttribute("name",
- attributeGroupObj.name);
- else
+ attGroupName);
+ }else
throw new XmlSchemaSerializerException("Attribute group must"
+ "have name");
if (attributeGroupObj.id != null)
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AttributeGroupTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AttributeGroupTest.java?view=diff&rev=540425&r1=540424&r2=540425
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AttributeGroupTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AttributeGroupTest.java Mon May 21 22:31:51 2007
@@ -89,7 +89,7 @@
for (Iterator i = attG.getValues(); i.hasNext(); ) {
Object obj1 = i.next();
if (obj1 instanceof XmlSchemaAttributeGroup) {
- assertEquals("department", ((XmlSchemaAttributeGroup)obj1).getName());
+ assertEquals("department", ((XmlSchemaAttributeGroup)obj1).getName().getLocalPart());
XmlSchemaObjectCollection attributes =
((XmlSchemaAttributeGroup)obj1).getAttributes();
assertNotNull(attributes);
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/GroupTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/GroupTest.java?view=diff&rev=540425&r1=540424&r2=540425
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/GroupTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/GroupTest.java Mon May 21 22:31:51 2007
@@ -116,7 +116,8 @@
+ s + ".",
s.isEmpty());
- assertEquals("priceGroup", xsg.getName());
+ assertNotNull(xsg);
+ assertEquals("priceGroup", xsg.getName().getLocalPart());
XmlSchemaChoice xsc = (XmlSchemaChoice)xsg.getParticle();
assertNotNull(xsc);
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/RedefineTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/RedefineTest.java?view=diff&rev=540425&r1=540424&r2=540425
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/RedefineTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/RedefineTest.java Mon May 21 22:31:51 2007
@@ -316,7 +316,7 @@
assertEquals(1, xsot.getCount());
for (Iterator i = xsot.getNames(); i.hasNext(); ) {
- assertEquals("PrologGroup", (String)i.next());
+ assertEquals("PrologGroup", ((QName)i.next()).getLocalPart());
}
XmlSchemaGroup xsg = null;
@@ -408,14 +408,16 @@
assertEquals(1, xsot.getCount());
for (Iterator i = xsot.getNames(); i.hasNext(); ) {
- assertEquals("AttribGroup", (String)i.next());
+ assertEquals("AttribGroup", ((QName)i.next()).getLocalPart());
}
XmlSchemaAttributeGroup xsag = null;
for (Iterator i = xsot.getValues(); i.hasNext(); ) {
xsag = (XmlSchemaAttributeGroup)i.next();
}
- assertEquals("AttribGroup", xsag.getName());
+
+ assertNotNull(xsag);
+ assertEquals("AttribGroup", (xsag.getName()).getLocalPart());
xsoc = xsag.getAttributes();
Set s = new HashSet();
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org