Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

NIFI:How to get node value using variable node name in nifi processor

avatar
Contributor

i have xml data like this below and i want to get localAttribtes tag by name 'rs' in my EvaluateXpath processor i tried this expression in my EvaluateXpath processor //localAttributes/*[@name='rs']/name() but i don't get "rs" tag value :

<?xml version="1.0" encoding="UTF-8" standalone="no"?><service><localAttributes name="rs"><start>2017-09-07</start><startDate>2017-02-02</startDate><endDate>2017-03-02</endDate><runAs>true</runAs><patch>this is patch</patch><makeVersion>1</makeVersion></localAttributes><localAttributes name="ns"><start>2017-09-07</start><startDate>2017-02-02</startDate><endDate>2017-03-02</endDate><runAs>true</runAs><patch>this is patch</patch><makeVersion>1</makeVersion></localAttributes></service>

39822-d.png

1 ACCEPTED SOLUTION

avatar
Master Guru
@sally sally

can you change the property to

//localAttributes[@name='rs']

it will gives you only

<?xml version="1.0" encoding="UTF-8"?><localAttributes name="rs">
<start>2017-09-07</start>
<startDate>2017-02-02</startDate>
<endDate>2017-03-02</endDate>
<runAs>true</runAs>
<patch>this is patch</patch>
<makeVersion>1</makeVersion>
</localAttributes>

(or)

if name=rs is first in value every time in local attribute node then you can use

//localAttributes[1]

will results the same output.

View solution in original post

2 REPLIES 2

avatar
Master Guru
@sally sally

can you change the property to

//localAttributes[@name='rs']

it will gives you only

<?xml version="1.0" encoding="UTF-8"?><localAttributes name="rs">
<start>2017-09-07</start>
<startDate>2017-02-02</startDate>
<endDate>2017-03-02</endDate>
<runAs>true</runAs>
<patch>this is patch</patch>
<makeVersion>1</makeVersion>
</localAttributes>

(or)

if name=rs is first in value every time in local attribute node then you can use

//localAttributes[1]

will results the same output.

avatar
Contributor

yes it was helpful thank you