You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by sa...@apache.org on 2010/10/22 17:15:19 UTC
svn commit: r1026362 - in /xerces/java/trunk/src/org/apache/xerces/impl/dv:
ValidatedInfo.java xs/XSSimpleTypeDecl.java
Author: sandygao
Date: Fri Oct 22 15:15:18 2010
New Revision: 1026362
URL: http://svn.apache.org/viewvc?rev=1026362&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/trunk/src/org/apache/xerces/impl/dv/ValidatedInfo.java
xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
Modified: xerces/java/trunk/src/org/apache/xerces/impl/dv/ValidatedInfo.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/dv/ValidatedInfo.java?rev=1026362&r1=1026361&r2=1026362&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/dv/ValidatedInfo.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/dv/ValidatedInfo.java Fri Oct 22 15:15:18 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/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java?rev=1026362&r1=1026361&r2=1026362&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java Fri Oct 22 15:15:18 2010
@@ -1818,8 +1818,6 @@ public class XSSimpleTypeDecl implements
ValidatedInfo validatedInfo, boolean needNormalize)
throws InvalidDatatypeValueException{
- validatedInfo.actualType = this;
-
String nvalue;
if (needNormalize) {
nvalue = normalize(content, fWhiteSpace);
@@ -1868,6 +1866,7 @@ public class XSSimpleTypeDecl implements
Object avalue = fDVs[fValidationDV].getActualValue(nvalue, context);
validatedInfo.actualValue = avalue;
validatedInfo.actualValueType = fBuiltInKind;
+ validatedInfo.actualType = this;
return avalue;
@@ -1905,6 +1904,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;
@@ -1924,7 +1925,7 @@ public class XSSimpleTypeDecl implements
fMemberTypes[i].checkFacets(validatedInfo);
}
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: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org