svn commit r16094 - trunk/wsf/javascript/rhino/e4ximpl/src/org/wso2/javascript/xmlimpl

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

svn commit r16094 - trunk/wsf/javascript/rhino/e4ximpl/src/org/wso2/javascript/xmlimpl

svn-9
Author: keith
Date: Thu Apr 24 01:54:04 2008
New Revision: 16094

Log:

Fix for Mashup-753



Modified:
   trunk/wsf/javascript/rhino/e4ximpl/src/org/wso2/javascript/xmlimpl/XML.java
   trunk/wsf/javascript/rhino/e4ximpl/src/org/wso2/javascript/xmlimpl/XMLList.java

Modified: trunk/wsf/javascript/rhino/e4ximpl/src/org/wso2/javascript/xmlimpl/XML.java
==============================================================================
--- trunk/wsf/javascript/rhino/e4ximpl/src/org/wso2/javascript/xmlimpl/XML.java (original)
+++ trunk/wsf/javascript/rhino/e4ximpl/src/org/wso2/javascript/xmlimpl/XML.java Thu Apr 24 01:54:04 2008
@@ -844,9 +844,9 @@
     Object getXmlObject() {
         if (axiomNode.isOMNode()) {
             return axiomNode.getOMNode();
-        } /*else if (axiomNode.isAttribute()) {
+        } else if (axiomNode.isAttribute()) {
             return axiomNode.getOMAttribute();
-        }*/
+        }
         return null;
     }
 
@@ -946,7 +946,14 @@
     }
 
     public OMNode getAxiomFromXML() {
-        return (OMNode) getXmlObject();
+        Object object = getXmlObject();
+        // If its an OMAttribute we take its value and create an OMText from it as we have to be
+        // returning an OMNode.
+        if (object instanceof OMAttribute) {
+            OMAttribute omAttribute = (OMAttribute) object;
+            return axiomNode.getOMFactory().createOMText(omAttribute.getAttributeValue());
+        }
+        return (OMNode) object;
     }
 
     AxiomNode getAxiomNode() {

Modified: trunk/wsf/javascript/rhino/e4ximpl/src/org/wso2/javascript/xmlimpl/XMLList.java
==============================================================================
--- trunk/wsf/javascript/rhino/e4ximpl/src/org/wso2/javascript/xmlimpl/XMLList.java (original)
+++ trunk/wsf/javascript/rhino/e4ximpl/src/org/wso2/javascript/xmlimpl/XMLList.java Thu Apr 24 01:54:04 2008
@@ -19,6 +19,7 @@
 
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMText;
+import org.apache.axiom.om.OMAttribute;
 import org.mozilla.javascript.Callable;
 import org.mozilla.javascript.Context;
 import org.mozilla.javascript.Function;
@@ -713,7 +714,17 @@
         int length = length();
         OMNode[] omNodes = new OMNode[length];
         for (int i = 0; i < length; i++) {
-            omNodes[i] = (OMNode) getFromAxiomNodeList(i).getXmlObject();
+            XML xml = getFromAxiomNodeList(i);
+            Object object = xml.getXmlObject();
+            // If its an OMAttribute we take its value and create an OMText from it as we have to be
+            // returning an OMNode.
+            if (object instanceof OMAttribute) {
+                OMAttribute omAttribute = (OMAttribute) object;
+                omNodes[i] = xml.getAxiomNode().getOMFactory()
+                        .createOMText(omAttribute.getAttributeValue());
+            } else {
+                omNodes[i] = (OMNode) object;
+            }
         }
         return omNodes;
     }

_______________________________________________
Wsf-javascript-dev mailing list
[hidden email]
http://wso2.org/cgi-bin/mailman/listinfo/wsf-javascript-dev
Loading...