Author: mukulg
Date: Mon Jan  7 16:09:33 2013
New Revision: 1429869

URL: http://svn.apache.org/viewvc?rev=1429869&view=rev
Log:
schema 1.1 commit: improving computing typed value of assertion xpath2 context 
variable $value, during following scenario,
$value represents value for a simpleType which is derived by restriction from a 
list and itemType of that list is a union.

Modified:
    
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertionXPath2ValueImpl.java

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertionXPath2ValueImpl.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertionXPath2ValueImpl.java?rev=1429869&r1=1429868&r2=1429869&view=diff
==============================================================================
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertionXPath2ValueImpl.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertionXPath2ValueImpl.java
 Mon Jan  7 16:09:33 2013
@@ -124,8 +124,7 @@ public class XSAssertionXPath2ValueImpl 
         
         if (listOrUnionType != null) {
             if (isTypeDerivedFromList || listOrUnionType.getVariety() == 
XSSimpleTypeDefinition.VARIETY_LIST) {
-                // $value is a sequence of atomic values (with type annotation 
xs:anyAtomicType*)
-                // tokenize the list value by a sequence of white spaces
+                // $value is a sequence of atomic values (with type annotation 
xs:anyAtomicType*). tokenize the list value by a sequence of white spaces.
                 StringTokenizer listStrTokens = new StringTokenizer(value, " 
\n\t\r");
                 List xdmItemList = new ArrayList();
                 while (listStrTokens.hasMoreTokens()) {
@@ -185,10 +184,17 @@ public class XSAssertionXPath2ValueImpl 
     public void setXDMTypedValueOf$valueForSTVarietyList(Element 
rootNodeOfAssertTree, String listStrValue, XSSimpleTypeDefinition itemType, 
boolean isTypeDerivedFromList, DynamicContext xpath2DynamicContext) throws 
Exception {
         
        if (itemType.getVariety() == XSSimpleTypeDefinition.VARIETY_UNION) {
-          // the list's item type has variety 'union'
-          XSSimpleTypeDefinition actualListItemType = 
getActualXDMItemTypeForSTVarietyUnion(itemType.getMemberTypes(), listStrValue);
-          // set a schema 'typed value' to variable $value
-          setXDMTypedValueOf$value(rootNodeOfAssertTree, listStrValue, 
actualListItemType, null, false, xpath2DynamicContext);
+           // itemType of xs:list has variety 'union'
+           List xdmItemList = new ArrayList();
+           XSObjectList memberTypes = itemType.getMemberTypes();
+           // tokenize the list value by a sequence of white spaces
+           StringTokenizer values = new StringTokenizer(listStrValue, " 
\n\t\r");
+           while (values.hasMoreTokens()) {
+               String itemValue = values.nextToken();
+               XSSimpleTypeDefinition listItemTypeForUnion = 
getActualXDMItemTypeForSTVarietyUnion(memberTypes, itemValue);
+               
xdmItemList.add(SchemaTypeValueFactory.newSchemaTypeValue(listItemTypeForUnion.getBuiltInKind(),
 itemValue));
+           }
+           xpath2DynamicContext.set_variable(new 
org.eclipse.wst.xml.xpath2.processor.internal.types.QName("value"), 
XS11TypeHelper.getXPath2ResultSequence(xdmItemList));
        } 
        else {
           setXDMTypedValueOf$value(rootNodeOfAssertTree, listStrValue, 
itemType, null, isTypeDerivedFromList, xpath2DynamicContext); 
@@ -228,13 +234,12 @@ public class XSAssertionXPath2ValueImpl 
         if (complexTypeSimplContentType.getVariety() == 
XSSimpleTypeDefinition.VARIETY_LIST) {
             // simple content type has variety xs:list
             XSSimpleTypeDefinition listItemType = 
complexTypeSimplContentType.getItemType();
-            // tokenize the list value by a sequence of white spaces
-            StringTokenizer values = new StringTokenizer(value, " \n\t\r");    
        
-            // $value is a sequence of atomic values (with type annotation 
xs:anyAtomicType*)
+            // $value is a sequence of atomic values (with type annotation 
xs:anyAtomicType*). tokenize the list value by a sequence of white spaces.
+            StringTokenizer values = new StringTokenizer(value, " \n\t\r");
             List xdmItemList = new ArrayList();
-            final XSObjectList memberTypes = listItemType.getMemberTypes();
-            if (memberTypes.getLength() > 0) {
-               // itemType of xs:list has variety 'union'. here list items may 
have different types which are determined below.
+            if (listItemType.getVariety() == 
XSSimpleTypeDefinition.VARIETY_UNION) {
+               // itemType of xs:list has variety 'union'
+               final XSObjectList memberTypes = listItemType.getMemberTypes();
                while (values.hasMoreTokens()) {
                    String itemValue = values.nextToken();
                    XSSimpleTypeDefinition listItemTypeForUnion = 
getActualXDMItemTypeForSTVarietyUnion(memberTypes, itemValue);



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org
For additional commands, e-mail: commits-h...@xerces.apache.org

Reply via email to