[ https://issues.apache.org/jira/browse/VELTOOLS-188?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jens Popp updated VELTOOLS-188: ------------------------------- Description: I'm processing a XML file with multiple Namespaces (lets say b for book and a for author: {{<b:book xmlns:b="http://www.test.com/book" xmlns:a="http://www.test.com/author" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">}} ). The xml is generated from a JAXB class. In the past I could just address this as: $book=$xmlTool.parse($xmlText).get("b:book") $authorName=$book.find("./b:author/a:name") With the new versions that does not seem to work. The return value from get(...) is always null. It seems, that the XPath is missing the NamespaceContext from the parsed file. If I modify XPath expression in find to search e.g. for local name or if I "inject" (by replacing some code in VelocityTools) the Namespace it works. It also works with old Dom4j/jaxen combination in VelocityTools 2.0. I attached a Quick & Dirty Patch that works for me. It is based on the trunk of veloctity tools from SVN. I used the code from [https://www.ibm.com/developerworks/library/x-nmspccontext/index.html] for the Namespace Cache class. was: I'm processing a XML file with multiple Namespaces (lets say b for book and a for author: {{<b:book xmlns:b="http://www.test.com/book" xmlns:a="http://www.test.com/author" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">}} ). The xml is generated from a JAXB class. In the past I could just address this as: $book=$xmlTool.parse($xmlText).get("b:book") $authorName=$book.find("./b:author/a:name") With the new versions that does not seem to work. The return value from get(...) is always null. It seems, that the XPath is missing the NamespaceContext from the parsed file. If I modify XPath expression in find to search e.g. for local name or if I "inject" (by replacing some code in VelocityTools) the Namespace it works. It also works with old Dom4j/jaxen combination in VelocityTools 2.0. I attached a Quick & Dirty Patch that works for me. It is based on the trunk of veloctity tools from SVN. > Velocity XmlTool 3.0 with multiple namespaces does not execute > -------------------------------------------------------------- > > Key: VELTOOLS-188 > URL: https://issues.apache.org/jira/browse/VELTOOLS-188 > Project: Velocity Tools > Issue Type: Bug > Affects Versions: 3.0 > Reporter: Jens Popp > Priority: Major > Attachments: patch.txt > > > I'm processing a XML file with multiple Namespaces (lets say b for book and a > for author: > {{<b:book xmlns:b="http://www.test.com/book" > xmlns:a="http://www.test.com/author" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">}} ). > The xml is generated from a JAXB class. In the past I could just address this > as: > $book=$xmlTool.parse($xmlText).get("b:book") > $authorName=$book.find("./b:author/a:name") > With the new versions that does not seem to work. The return value from > get(...) is always null. It seems, that the XPath is missing the > NamespaceContext from the parsed file. If I modify XPath expression in find > to search e.g. for local name or if I "inject" (by replacing some code in > VelocityTools) the Namespace it works. It also works with old Dom4j/jaxen > combination in VelocityTools 2.0. > I attached a Quick & Dirty Patch that works for me. It is based on the trunk > of veloctity tools from SVN. I used the code from > [https://www.ibm.com/developerworks/library/x-nmspccontext/index.html] for > the Namespace Cache class. > -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org For additional commands, e-mail: dev-h...@velocity.apache.org