You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jaxme-dev@ws.apache.org by ia...@apache.org on 2003/12/10 12:41:58 UTC
cvs commit: ws-jaxme/src/xs/org/apache/ws/jaxme/xs/impl XSTypeImpl.java
ias 2003/12/10 03:41:58
Modified: src/xs/org/apache/ws/jaxme/xs/impl XSTypeImpl.java
Log:
Bug fix - baseObject from getXsObject() is not always XsTSimpleType-typed.
Revision Changes Path
1.10 +55 -48 ws-jaxme/src/xs/org/apache/ws/jaxme/xs/impl/XSTypeImpl.java
Index: XSTypeImpl.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/xs/org/apache/ws/jaxme/xs/impl/XSTypeImpl.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- XSTypeImpl.java 28 Nov 2003 07:39:17 -0000 1.9
+++ XSTypeImpl.java 10 Dec 2003 11:41:58 -0000 1.10
@@ -69,6 +69,7 @@
/**
* @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ * @author <a href="mailto:iasandcb@tmax.co.kr">Ias</a>
*/
public class XSTypeImpl extends XSOpenAttrsImpl implements XSType {
public abstract class XSComplexTypeImpl implements XSComplexType {
@@ -630,55 +631,61 @@
if (isSimple()) {
XSSimpleType mySimpleType;
- XsTSimpleType myXsTSimpleType = (XsTSimpleType) getXsObject();
- XsEList list = myXsTSimpleType.getList();
- if (list == null) {
- XsEUnion union = myXsTSimpleType.getUnion();
- if (union == null) {
- XsERestriction restriction = myXsTSimpleType.getRestriction();
- if (restriction == null) {
- throw new LocSAXException("Either of the 'list', 'union', or 'restriction' child elements must be set.",
- myXsTSimpleType.getLocator());
- }
- XsQName myName = restriction.getBase();
- XSType restrictedType;
- if (myName == null) {
- XsTLocalSimpleType baseType = restriction.getSimpleType();
- if (baseType == null) {
- throw new LocSAXException("Neither the 'base' attribute nor an inner 'simpleType' element are present",
- restriction.getLocator());
- } else {
- restrictedType = getXSSchema().getXSObjectFactory().newXSType(this, baseType);
- }
- } else {
- restrictedType = getXSSchema().getType(myName);
- if (restrictedType == null) {
- throw new LocSAXException("Unknown base type: " + myName,
- restriction.getLocator());
- }
- }
- restrictedType.validate();
- if (!restrictedType.isSimple()) {
- throw new LocSAXException("The restricted type " + myName + " is complex.",
- restriction.getLocator());
- }
- XSSimpleType baseType = restrictedType.getSimpleType();
- if (baseType.isAtomic()) {
- mySimpleType = getXSSchema().getXSObjectFactory().newXSAtomicType(this, restrictedType, restriction);
- } else if (baseType.isList()) {
- mySimpleType = getXSSchema().getXSObjectFactory().newXSListType(this, restrictedType, restriction);
- } else if (baseType.isUnion()) {
- mySimpleType = getXSSchema().getXSObjectFactory().newXSUnionType(this, restrictedType, restriction);
- } else {
- throw new LocSAXException("Unknown restriction type: " + baseType, restriction.getLocator());
- }
- } else {
- mySimpleType = getXSSchema().getXSObjectFactory().newXSUnionType(this, union);
- }
- } else {
- mySimpleType = getXSSchema().getXSObjectFactory().newXSListType(this, list);
+ Object baseObject = getXsObject();
+ if (baseObject instanceof XsTSimpleType) {
+ XsTSimpleType myXsTSimpleType = (XsTSimpleType) baseObject;
+ XsEList list = myXsTSimpleType.getList();
+ if (list == null) {
+ XsEUnion union = myXsTSimpleType.getUnion();
+ if (union == null) {
+ XsERestriction restriction = myXsTSimpleType.getRestriction();
+ if (restriction == null) {
+ throw new LocSAXException("Either of the 'list', 'union', or 'restriction' child elements must be set.",
+ myXsTSimpleType.getLocator());
+ }
+ XsQName myName = restriction.getBase();
+ XSType restrictedType;
+ if (myName == null) {
+ XsTLocalSimpleType baseType = restriction.getSimpleType();
+ if (baseType == null) {
+ throw new LocSAXException("Neither the 'base' attribute nor an inner 'simpleType' element are present",
+ restriction.getLocator());
+ } else {
+ restrictedType = getXSSchema().getXSObjectFactory().newXSType(this, baseType);
+ }
+ } else {
+ restrictedType = getXSSchema().getType(myName);
+ if (restrictedType == null) {
+ throw new LocSAXException("Unknown base type: " + myName,
+ restriction.getLocator());
+ }
+ }
+ restrictedType.validate();
+ if (!restrictedType.isSimple()) {
+ throw new LocSAXException("The restricted type " + myName + " is complex.",
+ restriction.getLocator());
+ }
+ XSSimpleType baseType = restrictedType.getSimpleType();
+ if (baseType.isAtomic()) {
+ mySimpleType = getXSSchema().getXSObjectFactory().newXSAtomicType(this, restrictedType, restriction);
+ } else if (baseType.isList()) {
+ mySimpleType = getXSSchema().getXSObjectFactory().newXSListType(this, restrictedType, restriction);
+ } else if (baseType.isUnion()) {
+ mySimpleType = getXSSchema().getXSObjectFactory().newXSUnionType(this, restrictedType, restriction);
+ } else {
+ throw new LocSAXException("Unknown restriction type: " + baseType, restriction.getLocator());
+ }
+ } else {
+ mySimpleType = getXSSchema().getXSObjectFactory().newXSUnionType(this, union);
+ }
+ } else {
+ mySimpleType = getXSSchema().getXSObjectFactory().newXSListType(this, list);
+ }
}
-
+ else {
+ mySimpleType = getSimpleType();
+ }
+
this.simpleType = mySimpleType;
} else {
XSComplexTypeImpl myComplexType;
---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org