axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r490409 - in /webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj: SOAPBodyImpl.java SOAPElementImpl.java
Date Wed, 27 Dec 2006 00:10:04 GMT
Author: dims
Date: Tue Dec 26 16:10:03 2006
New Revision: 490409

URL: http://svn.apache.org/viewvc?view=rev&rev=490409
Log:
low hanging fruits

Modified:
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyImpl.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPElementImpl.java

Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyImpl.java?view=diff&rev=490409&r1=490408&r2=490409
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyImpl.java
(original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyImpl.java
Tue Dec 26 16:10:03 2006
@@ -290,7 +290,7 @@
     }
 
     public SOAPBodyElement addBodyElement(QName qname) throws SOAPException {
-        return null;  //TODO: Fixme.
+        return (SOAPBodyElement) addChildElement(qname);
     }
 
     public SOAPFault addFault(QName qname, String s) throws SOAPException {

Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPElementImpl.java?view=diff&rev=490409&r1=490408&r2=490409
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPElementImpl.java
(original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPElementImpl.java
Tue Dec 26 16:10:03 2006
@@ -377,12 +377,17 @@
         return returnList.iterator();
     }
 
-    public SOAPElement addAttribute(QName qname, String s) throws SOAPException {
-        return null;  //TODO: Fixme.
+    public SOAPElement addAttribute(QName name, String value) throws SOAPException {
+        if (name.getNamespaceURI() == null || name.getNamespaceURI().trim().length() == 0)
{
+            element.setAttribute(name.getLocalPart(), value);
+        } else {
+            element.setAttributeNS(name.getNamespaceURI(), name.getPrefix() + ":" + name.getLocalPart(),
value);
+        }
+        return this;
     }
 
     public SOAPElement addChildElement(QName qname) throws SOAPException {
-        return null;  //TODO: Fixme.
+        return addChildElement(qname.getLocalPart(), qname.getPrefix()  , qname.getNamespaceURI());
     }
 
     public QName createQName(String s, String s1) throws SOAPException {
@@ -394,19 +399,40 @@
     }
 
     public String getAttributeValue(QName qname) {
-        return null;  //TODO: Fixme.
+        //This method is waiting on the finalization of the name for a method
+        //in OMElement that returns a OMAttribute from an input QName
+        final OMAttribute attribute = element.getAttribute(new QName(qname.getNamespaceURI(),
+                                                                     qname.getLocalPart(),
+                                                                     qname.getPrefix()));
+        if (attribute == null) {
+            return null;
+        }
+        return attribute.getAttributeValue();
     }
 
     public Iterator getChildElements(QName name) {
-        return null;  //TODO: Fixme.
+        QName qName = new QName(name.getNamespaceURI(), name.getLocalPart());
+        Iterator childIter = element.getChildrenWithName(qName);
+        Collection childElements = new ArrayList();
+        while (childIter.hasNext()) {
+            childElements.add(toSAAJNode((org.w3c.dom.Node) childIter.next()));
+        }
+        return childElements.iterator();
     }
 
     public QName getElementQName() {
         return null;  //TODO: Fixme.
     }
 
-    public boolean removeAttribute(QName qname) {
-        return false;  //TODO: Fixme.
+    public boolean removeAttribute(QName name) {
+        org.apache.axiom.om.OMAttribute attr = element.getAttribute(new QName(name.getNamespaceURI(),
+                                                                                   name.getLocalPart(),
+                                                                                   name.getPrefix()));
+        if (attr != null) {
+            element.removeAttribute(attr);
+            return true;
+        }
+        return false;
     }
 
     public SOAPElement setElementQName(QName qname) throws SOAPException {



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message