You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ws.apache.org by Amila Jayasekara <am...@wso2.com> on 2012/01/23 09:25:24 UTC

Fwd: svn commit: r1234495 - in /webservices/commons/trunk/modules/axiom/modules: axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestCreateElementNS.java axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java

Hi Andreas,

Following change causes OMElement.getFirstChildWithName to always return null.

E.g :-
OMElement rst = ...
OMElement elem = rst.getFirstChildWithName(new QName(XML.SAML_NS, "Assertion"));

Due to this Rampart build is failing. Seems like namespace is not
correctly mapped. Could you please have a look ?

Thanks
AmilaJ


---------- Forwarded message ----------
From: <ve...@apache.org>
Date: Sun, Jan 22, 2012 at 5:28 PM
Subject: svn commit: r1234495 - in
/webservices/commons/trunk/modules/axiom/modules:
axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestCreateElementNS.java
axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
To: commits@ws.apache.org


Author: veithen
Date: Sun Jan 22 11:58:19 2012
New Revision: 1234495

URL: http://svn.apache.org/viewvc?rev=1234495&view=rev
Log:
Fixed a non-conformance in Document#createElementNS.

Modified:
   webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestCreateElementNS.java
   webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestCreateElementNS.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestCreateElementNS.java?rev=1234495&r1=1234494&r2=1234495&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestCreateElementNS.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestCreateElementNS.java
Sun Jan 22 11:58:19 2012
@@ -36,5 +36,7 @@ public class TestCreateElementNS extends
        Element elem = doc.createElementNS(namespace, "axis2:" + tagName);
        assertEquals("Local name misnatch", tagName, elem.getLocalName());
        assertEquals("Namespace misnatch", namespace, elem.getNamespaceURI());
+        // In contrast to Axiom, DOM doesn't generate namespace
declarations automatically
+        assertEquals(0, elem.getAttributes().getLength());
    }
 }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java?rev=1234495&r1=1234494&r2=1234495&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
Sun Jan 22 11:58:19 2012
@@ -216,7 +216,11 @@ public class DocumentImpl extends Parent
        }

        OMNamespaceImpl namespace = new OMNamespaceImpl(ns, prefix);
-        return new ElementImpl(this, localName, namespace, this.factory);
+        // DOM doesn't create namespace declarations automatically.
Therefore we set the
+        // namespace afterwards with setNamespaceWithNoFindInCurrentScope.
+        ElementImpl element = new ElementImpl(this, localName, null,
this.factory);
+        element.setNamespaceWithNoFindInCurrentScope(namespace);
+        return element;
    }

    public EntityReference createEntityReference(String name)





--
Sagara Gunathunga

Blog      - http://ssagara.blogspot.com
Web      - http://people.apache.org/~sagara/
LinkedIn - http://www.linkedin.com/in/ssagara


-- 
Mobile : +94773330538

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


Re: svn commit: r1234495 - in /webservices/commons/trunk/modules/axiom/modules: axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestCreateElementNS.java axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java

Posted by Andreas Veithen <an...@gmail.com>.
The problem is a bit more complicated. If DOOM behaves strictly as
required by DOM, then responses from the STS are not serialized
correctly because Santuario assumes that all namespace declarations
are present. I debugged that yesterday but didn't get the time yet to
implement a temporary workaround or a proper fix.

Andreas

On Mon, Jan 23, 2012 at 09:25, Amila Jayasekara <am...@wso2.com> wrote:
> Hi Andreas,
>
> Following change causes OMElement.getFirstChildWithName to always return null.
>
> E.g :-
> OMElement rst = ...
> OMElement elem = rst.getFirstChildWithName(new QName(XML.SAML_NS, "Assertion"));
>
> Due to this Rampart build is failing. Seems like namespace is not
> correctly mapped. Could you please have a look ?
>
> Thanks
> AmilaJ
>
>
> ---------- Forwarded message ----------
> From: <ve...@apache.org>
> Date: Sun, Jan 22, 2012 at 5:28 PM
> Subject: svn commit: r1234495 - in
> /webservices/commons/trunk/modules/axiom/modules:
> axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestCreateElementNS.java
> axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
> To: commits@ws.apache.org
>
>
> Author: veithen
> Date: Sun Jan 22 11:58:19 2012
> New Revision: 1234495
>
> URL: http://svn.apache.org/viewvc?rev=1234495&view=rev
> Log:
> Fixed a non-conformance in Document#createElementNS.
>
> Modified:
>    webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestCreateElementNS.java
>    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
>
> Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestCreateElementNS.java
> URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestCreateElementNS.java?rev=1234495&r1=1234494&r2=1234495&view=diff
> ==============================================================================
> --- webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestCreateElementNS.java
> (original)
> +++ webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestCreateElementNS.java
> Sun Jan 22 11:58:19 2012
> @@ -36,5 +36,7 @@ public class TestCreateElementNS extends
>         Element elem = doc.createElementNS(namespace, "axis2:" + tagName);
>         assertEquals("Local name misnatch", tagName, elem.getLocalName());
>         assertEquals("Namespace misnatch", namespace, elem.getNamespaceURI());
> +        // In contrast to Axiom, DOM doesn't generate namespace
> declarations automatically
> +        assertEquals(0, elem.getAttributes().getLength());
>     }
>  }
>
> Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
> URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java?rev=1234495&r1=1234494&r2=1234495&view=diff
> ==============================================================================
> --- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
> (original)
> +++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
> Sun Jan 22 11:58:19 2012
> @@ -216,7 +216,11 @@ public class DocumentImpl extends Parent
>         }
>
>         OMNamespaceImpl namespace = new OMNamespaceImpl(ns, prefix);
> -        return new ElementImpl(this, localName, namespace, this.factory);
> +        // DOM doesn't create namespace declarations automatically.
> Therefore we set the
> +        // namespace afterwards with setNamespaceWithNoFindInCurrentScope.
> +        ElementImpl element = new ElementImpl(this, localName, null,
> this.factory);
> +        element.setNamespaceWithNoFindInCurrentScope(namespace);
> +        return element;
>     }
>
>     public EntityReference createEntityReference(String name)
>
>
>
>
>
> --
> Sagara Gunathunga
>
> Blog      - http://ssagara.blogspot.com
> Web      - http://people.apache.org/~sagara/
> LinkedIn - http://www.linkedin.com/in/ssagara
>
>
> --
> Mobile : +94773330538
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: dev-help@ws.apache.org
>

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