Author: sandygao
Date: Fri Oct 22 15:17:23 2010
New Revision: 1026364
URL: http://svn.apache.org/viewvc?rev=1026364&view=rev
Log:
When evaluating list values, need to set the "actualType" after the list is
processed, otherwise the "actualType" would have the item type, because same
ValidatedInfo is used to process both the list and the items. And when copying
an XSValue, need to be careful to only ask for the memberTypes if the type is a
list of union.
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/ValidatedInfo.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/ValidatedInfo.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/ValidatedInfo.java?rev=1026364&r1=1026363&r2=1026364&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/ValidatedInfo.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/ValidatedInfo.java
Fri Oct 22 15:17:23 2010
@@ -219,16 +219,17 @@ public class ValidatedInfo implements XS
actualValueType = o.getActualValueType();
actualType = (XSSimpleType)o.getTypeDefinition();
memberType = (XSSimpleType)o.getMemberTypeDefinition();
- XSObjectList members = o.getMemberTypeDefinitions();
- if (members == null || members.getLength() == 0) {
- memberTypes = null;
- }
- else {
+ XSSimpleType realType = memberType == null ? actualType :
memberType;
+ if (realType != null && realType.getBuiltInKind() ==
XSConstants.LISTOFUNION_DT) {
+ XSObjectList members = o.getMemberTypeDefinitions();
memberTypes = new XSSimpleType[members.getLength()];
for (int i = 0; i < members.getLength(); i++) {
memberTypes[i] = (XSSimpleType)members.get(i);
}
}
+ else {
+ memberTypes = null;
+ }
itemValueTypes = o.getListValueTypes();
}
}
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java?rev=1026364&r1=1026363&r2=1026364&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
Fri Oct 22 15:17:23 2010
@@ -2044,8 +2044,6 @@ public class XSSimpleTypeDecl implements
ValidatedInfo validatedInfo, boolean needNormalize)
throws InvalidDatatypeValueException{
- validatedInfo.actualType = this;
-
String nvalue;
if (needNormalize) {
nvalue = normalize(content, fWhiteSpace);
@@ -2094,6 +2092,7 @@ public class XSSimpleTypeDecl implements
Object avalue = fDVs[fValidationDV].getActualValue(nvalue,
context);
validatedInfo.actualValue = avalue;
validatedInfo.actualValueType = fBuiltInKind;
+ validatedInfo.actualType = this;
return avalue;
@@ -2131,6 +2130,8 @@ public class XSSimpleTypeDecl implements
validatedInfo.memberTypes = memberTypes;
validatedInfo.itemValueTypes = new ShortListImpl(itemTypes,
itemTypes.length);
validatedInfo.normalizedValue = nvalue;
+ // Need to set it here or it will become the item type
+ validatedInfo.actualType = this;
return v;
@@ -2154,7 +2155,7 @@ public class XSSimpleTypeDecl implements
validatedInfo.memberType = fMemberTypes[i];
}
- // Set this again because it was changed to the member type
+ // Need to set it here or it will become the member type
validatedInfo.actualType = this;
return aValue;
} catch(InvalidDatatypeValueException invalidValue) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]