[ 
https://issues.apache.org/jira/browse/NIFI-9737?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Stieglitz resolved NIFI-9737.
------------------------------------
    Resolution: Fixed

The issue described in this ticket is an Xpath issue and not an NIFI issue. The 
explanation of this issue and possible solutions can be found on this 
Stackoverflow 
[thread|https://stackoverflow.com/questions/23492186/why-xpath-does-not-work-with-xmlns-attribute].
 Paraphrased for your example

Placing xmlns="http://latest/nmc-omc/cmNrm.doc#measCollec"; on the root element 
of your XML puts the root and its descendants in the 
http://latest/nmc-omc/cmNrm.doc#measCollec namespace. This effectively means 
that all of the element names in your XML document are preceded by 
http://latest/nmc-omc/cmNrm.doc#measCollec. Yet, the elements stated in your 
XPath are not in the http://latest/nmc-omc/cmNrm.doc#measCollec. Thus, your 
XPath matches nothing.

> Unreachable namespaces seem to break EvaluateXPath/Query
> --------------------------------------------------------
>
>                 Key: NIFI-9737
>                 URL: https://issues.apache.org/jira/browse/NIFI-9737
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>            Reporter: Cemre Mengu
>            Priority: Major
>
> I have an XML file that has 
> xmlns="http://latest/nmc-omc/cmNrm.doc#measCollec"; attribute in root tag. As 
> long this attribute is present, all expressions evaluate to empty strings. If 
> I remove this, everything works as expected.
> I am assuming that it tries and fails to resolve this namespace. However, I 
> actually don't need this namespace at all. Is there any way to ignore this 
> behavior if it is intentional?
> It can be reproduced with the following simple content where any simple xpath 
> expression like /bookstore/book[1] will fail
> {code:java}
> <bookstore xmlns="http://latest/nmc-omc/cmNrm.doc#measCollec"; >
>   <book category="cooking">
>     <title lang="en">Everyday Italian</title>
>     <author>Giada De Laurentiis</author>
>     <year>2005</year>
>     <price>30.00</price>
>   </book>
> </bookstore>{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to