Support Questions
Find answers, ask questions, and share your expertise

Nifi XPATH for attributes with Namespaces

Nifi XPATH for attributes with Namespaces

Explorer

Hello, I'm trying to pull the attribute out of an xml node, but it has a namespace. I've had success getting a node using the [local-name="myField"] syntax, but no such luck with an attribute. My xml looks like this....

 

<Books xlmns:tech="urn:mstp:tech:gov">
    <unit:Unit xmlns:ns1="urn:us:edu:ic:ian" ns1:myAtt="BINGO">
        <tech:Name>Rickie</tech:Name>
    </unit:Unit>
</Books>

 

 I'm trying to get the value of myAtt=BINGO.

 

I've been able to get the value Rickie from the name field using //*[local-name()='Name']. I've tried things like //@*[local-name()='myAtt'] and a million other things I've tried online and nothing seems to work.  Any other ideas?

 

@mburgess 

1 REPLY 1

Re: Nifi XPATH for attributes with Namespaces

Explorer

In the meantime, I was able to accomplish this using ExtractText along with some Substring statements in UpdateAttribute. It's a bit messy, but it gets me by.