Index: src/main/java/org/exolab/castor/xml/schema/ElementDecl.java
===================================================================
--- src/main/java/org/exolab/castor/xml/schema/ElementDecl.java (Revision 6990)
+++ src/main/java/org/exolab/castor/xml/schema/ElementDecl.java (Arbeitskopie)
@@ -445,8 +445,17 @@
while (enumeration.hasMoreElements()) {
ElementDecl temp = (ElementDecl)enumeration.nextElement();
String subName = temp.getSubstitutionGroup();
- if (subName!=null && subName.equals(_name))
- result.add(temp);
+ if (subName != null) {
+ // no namespace(s) or default namespace in use
+ if (subName.equals(_name)) {
+ result.add(temp);
+ }
+ // namespace(s) incl. prefix in use
+ // TODO: find a better way of dealing with a namespace prefix
+ else if (subName.endsWith(_name) && subName.indexOf(":") > 0) {
+ result.add(temp);
+ }
+ }
}
return result.elements();
}
Index: src/main/java/org/exolab/castor/xml/util/XMLClassDescriptorImpl.java
===================================================================
--- src/main/java/org/exolab/castor/xml/util/XMLClassDescriptorImpl.java (Revision 6990)
+++ src/main/java/org/exolab/castor/xml/util/XMLClassDescriptorImpl.java (Arbeitskopie)
@@ -376,7 +376,7 @@
// handle substitution groups !!!
List substitutes = expectedElementDescriptor.getSubstitutes();
- if (!substitutes.isEmpty()) {
+ if (substitutes != null && !substitutes.isEmpty()) {
if (substitutes.contains(elementName)) {
parentState.expectedIndex++;
return;
Index: xmlctf/tests/MasterTestSuite/sourcegenerator/substitutionGroups/withExplicitNamespace/builder.properties
===================================================================
--- xmlctf/tests/MasterTestSuite/sourcegenerator/substitutionGroups/withExplicitNamespace/builder.properties (Revision 0)
+++ xmlctf/tests/MasterTestSuite/sourcegenerator/substitutionGroups/withExplicitNamespace/builder.properties (Revision 0)
@@ -0,0 +1,4 @@
+# Specifies whether automatic class name conflict resolution
+# should be used or not; defaults to false.
+#
+org.exolab.castor.builder.automaticConflictResolution=true
Index: xmlctf/tests/MasterTestSuite/sourcegenerator/substitutionGroups/withExplicitNamespace/test.xsd
===================================================================
--- xmlctf/tests/MasterTestSuite/sourcegenerator/substitutionGroups/withExplicitNamespace/test.xsd (Revision 0)
+++ xmlctf/tests/MasterTestSuite/sourcegenerator/substitutionGroups/withExplicitNamespace/test.xsd (Revision 0)
@@ -0,0 +1,89 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: xmlctf/tests/MasterTestSuite/sourcegenerator/substitutionGroups/withExplicitNamespace/TestDescriptor.xml
===================================================================
--- xmlctf/tests/MasterTestSuite/sourcegenerator/substitutionGroups/withExplicitNamespace/TestDescriptor.xml (Revision 0)
+++ xmlctf/tests/MasterTestSuite/sourcegenerator/substitutionGroups/withExplicitNamespace/TestDescriptor.xml (Revision 0)
@@ -0,0 +1,18 @@
+
+
+ Tests for substitution groups with explicit namespace(s)
+ Werner Guttmann
+ Tests substitution group funtionality
+ basic capability
+
+ test.xsd
+ builder.properties
+ PurchaseOrder
+
+ true
+ TestPurchaseOrder
+ input.xml
+
+
+
+
Index: xmlctf/tests/MasterTestSuite/sourcegenerator/substitutionGroups/withExplicitNamespace/input.xml
===================================================================
--- xmlctf/tests/MasterTestSuite/sourcegenerator/substitutionGroups/withExplicitNamespace/input.xml (Revision 0)
+++ xmlctf/tests/MasterTestSuite/sourcegenerator/substitutionGroups/withExplicitNamespace/input.xml (Revision 0)
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+ Any Inc.
+ AnyTown, AnyCity
+
+
+ Any Inc.
+ AnyTown, AnyCity
+
+
+ The Little Engine That Could
+
+
+
+
+
+
+ Some Corp.
+ SomeTown, SomeCity
+
+
+ This Corp.
+ ThisTown, ThisCity
+
+
+ green
+
+ This is being billed to This Corp.
+
+
+
+
Index: xmlctf/tests/MasterTestSuite/sourcegenerator/substitutionGroups/withDefaultNamespace/builder.properties
===================================================================
--- xmlctf/tests/MasterTestSuite/sourcegenerator/substitutionGroups/withDefaultNamespace/builder.properties (Revision 0)
+++ xmlctf/tests/MasterTestSuite/sourcegenerator/substitutionGroups/withDefaultNamespace/builder.properties (Revision 0)
@@ -0,0 +1,4 @@
+# Specifies whether automatic class name conflict resolution
+# should be used or not; defaults to false.
+#
+org.exolab.castor.builder.automaticConflictResolution=true
Index: xmlctf/tests/MasterTestSuite/sourcegenerator/substitutionGroups/withDefaultNamespace/test.xsd
===================================================================
--- xmlctf/tests/MasterTestSuite/sourcegenerator/substitutionGroups/withDefaultNamespace/test.xsd (Revision 0)
+++ xmlctf/tests/MasterTestSuite/sourcegenerator/substitutionGroups/withDefaultNamespace/test.xsd (Revision 0)
@@ -0,0 +1,89 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: xmlctf/tests/MasterTestSuite/sourcegenerator/substitutionGroups/withDefaultNamespace/TestDescriptor.xml
===================================================================
--- xmlctf/tests/MasterTestSuite/sourcegenerator/substitutionGroups/withDefaultNamespace/TestDescriptor.xml (Revision 0)
+++ xmlctf/tests/MasterTestSuite/sourcegenerator/substitutionGroups/withDefaultNamespace/TestDescriptor.xml (Revision 0)
@@ -0,0 +1,18 @@
+
+
+ Tests for substitution groups with default namespace
+ Werner Guttmann
+ Tests substitution group funtionality
+ basic capability
+
+ test.xsd
+ builder.properties
+ PurchaseOrder
+
+ true
+ TestPurchaseOrder
+ input.xml
+
+
+
+
Index: xmlctf/tests/MasterTestSuite/sourcegenerator/substitutionGroups/withDefaultNamespace/input.xml
===================================================================
--- xmlctf/tests/MasterTestSuite/sourcegenerator/substitutionGroups/withDefaultNamespace/input.xml (Revision 0)
+++ xmlctf/tests/MasterTestSuite/sourcegenerator/substitutionGroups/withDefaultNamespace/input.xml (Revision 0)
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+ Any Inc.
+ AnyTown, AnyCity
+
+
+ Any Inc.
+ AnyTown, AnyCity
+
+
+ The Little Engine That Could
+
+
+
+
+
+
+ Some Corp.
+ SomeTown, SomeCity
+
+
+ This Corp.
+ ThisTown, ThisCity
+
+
+ green
+
+ This is being billed to This Corp.
+
+
+
+
Index: codegen/src/main/java/org/exolab/castor/builder/descriptors/DescriptorSourceFactory.java
===================================================================
--- codegen/src/main/java/org/exolab/castor/builder/descriptors/DescriptorSourceFactory.java (Revision 6990)
+++ codegen/src/main/java/org/exolab/castor/builder/descriptors/DescriptorSourceFactory.java (Arbeitskopie)
@@ -62,6 +62,7 @@
import org.exolab.castor.builder.types.XSListType;
import org.exolab.castor.builder.types.XSType;
import org.exolab.castor.xml.XMLConstants;
+import org.exolab.castor.xml.XMLFieldDescriptor;
import org.exolab.javasource.JClass;
import org.exolab.javasource.JConstructor;
import org.exolab.javasource.JField;
@@ -167,15 +168,15 @@
// handle substitution groups
List substitutionGroups = classInfo.getSubstitutionGroups();
if (!substitutionGroups.isEmpty()) {
- jsc.add("java.util.List substitutionGroupes = new java.util.ArrayList();");
+ jsc.add("java.util.List substitutionGroups = new java.util.ArrayList();");
Iterator substitutionGroupIter = substitutionGroups.iterator();
while (substitutionGroupIter.hasNext()) {
String substitutionGroup = (String) substitutionGroupIter.next();
- jsc.add("substitutionGroupes.add(\"");
+ jsc.add("substitutionGroups.add(\"");
jsc.append(substitutionGroup);
jsc.append("\");");
}
- jsc.add("setSubstitutes(substitutionGroupes);");
+ jsc.add("setSubstitutes(substitutionGroups);");
}
//-- To prevent compiler warnings...make sure