You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by co...@apache.org on 2011/07/22 17:18:09 UTC

svn commit: r1149630 - in /santuario/xml-security-java/branches/1.4.x-fixes: CHANGELOG.txt src/org/apache/xml/security/utils/ElementProxy.java

Author: coheigea
Date: Fri Jul 22 15:18:08 2011
New Revision: 1149630

URL: http://svn.apache.org/viewvc?rev=1149630&view=rev
Log:
[SANTUARIO-284] - ElementProxy#getTextFromChildElement() doesn't get all of the text if the element contains an entity like &

Modified:
    santuario/xml-security-java/branches/1.4.x-fixes/CHANGELOG.txt
    santuario/xml-security-java/branches/1.4.x-fixes/src/org/apache/xml/security/utils/ElementProxy.java

Modified: santuario/xml-security-java/branches/1.4.x-fixes/CHANGELOG.txt
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/1.4.x-fixes/CHANGELOG.txt?rev=1149630&r1=1149629&r2=1149630&view=diff
==============================================================================
--- santuario/xml-security-java/branches/1.4.x-fixes/CHANGELOG.txt (original)
+++ santuario/xml-security-java/branches/1.4.x-fixes/CHANGELOG.txt Fri Jul 22 15:18:08 2011
@@ -1,6 +1,7 @@
 Changelog for "Apache xml-security" <http://santuario.apache.org/>
 
 New in v.1.4.6-SNAPSHOT:
+    Fixed SANTUARIO-284: ElementProxy#getTextFromChildElement() doesn't get all of the text if the element contains an entity like &amp;
     Fixed SANTUARIO-283: JSR105 does not retain namespace definitions on Object element when unmarshalling
     Fixed SANTUARIO-281: Invalid signature value when using XMLSignature in two EJB modules on AS
     Fixed SANTUARIO-102: Private keys must be instance of RSAPrivate or have PKCS#8 encoding

Modified: santuario/xml-security-java/branches/1.4.x-fixes/src/org/apache/xml/security/utils/ElementProxy.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/1.4.x-fixes/src/org/apache/xml/security/utils/ElementProxy.java?rev=1149630&r1=1149629&r2=1149630&view=diff
==============================================================================
--- santuario/xml-security-java/branches/1.4.x-fixes/src/org/apache/xml/security/utils/ElementProxy.java (original)
+++ santuario/xml-security-java/branches/1.4.x-fixes/src/org/apache/xml/security/utils/ElementProxy.java Fri Jul 22 15:18:08 2011
@@ -395,15 +395,22 @@ public abstract class ElementProxy {
     * @return the Text of the textNode
     */
    public String getTextFromChildElement(String localname, String namespace) {
-              
-         Text t =
-             (Text) XMLUtils.selectNode(
-                        this._constructionElement.getFirstChild(),
-                        namespace,
-                        localname,
-                        0).getFirstChild();
-
-         return t.getData();      
+       Node textParent = 
+           XMLUtils.selectNode(
+                   this._constructionElement.getFirstChild(),
+                   namespace,
+                   localname,
+                   0);
+       Node textChild = textParent.getFirstChild();
+       StringBuffer text = new StringBuffer();
+       while (textChild != null) {
+           if (textChild instanceof Text) {
+               text.append(((Text)textChild).getData());
+           }
+           textChild = textChild.getNextSibling();
+       }
+       
+       return text.toString(); 
    }
 
    /**