gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] 02/02: Solve XPath problem with namespaces.


From: gnunet
Subject: [libeufin] 02/02: Solve XPath problem with namespaces.
Date: Thu, 26 Mar 2020 09:10:31 +0100

This is an automated email from the git hooks/post-receive script.

marcello pushed a commit to branch master
in repository libeufin.

commit ed631099da00ece0d1ddf058f06d753200748470
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu Mar 26 09:10:00 2020 +0100

    Solve XPath problem with namespaces.
---
 nexus/src/test/kotlin/XPathTest.kt | 36 +++++++++++++++++++++++++++++-------
 1 file changed, 29 insertions(+), 7 deletions(-)

diff --git a/nexus/src/test/kotlin/XPathTest.kt 
b/nexus/src/test/kotlin/XPathTest.kt
index fe12db3..2e796fa 100644
--- a/nexus/src/test/kotlin/XPathTest.kt
+++ b/nexus/src/test/kotlin/XPathTest.kt
@@ -2,6 +2,7 @@ package tech.libeufin.nexus
 
 import org.junit.Test
 import org.w3c.dom.Document
+import org.w3c.dom.Node
 import tech.libeufin.util.XMLUtil
 
 
@@ -10,13 +11,34 @@ class XPathTest {
     @Test
     fun pickDataFromSimpleXml() {
         val xml = """
-            <root>
+            <root xmlns="foo">
               <node>lorem ipsum</node>
             </root>""".trimIndent()
-        val doc: Document = tech.libeufin.util.XMLUtil.parseStringIntoDom(xml)
-        val nodeSlashes = XMLUtil.evalXpath(doc, "/root/node/text()")
-        println(nodeSlashes?.nodeValue) 
-        val nodeDoubleSlashes = XMLUtil.evalXpath(doc, "//node/text()")
-        println(nodeDoubleSlashes?.nodeValue)
+        val doc: Document = XMLUtil.parseStringIntoDom(xml)
+        val node = XMLUtil.evalXpath(doc, "/*[local-name()='root']")
+        assert(node != null)
     }
-}
\ No newline at end of file
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]