Jens Popp created VELTOOLS-188:
----------------------------------

             Summary: 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
         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.



--
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

Reply via email to