Hi am having an XML file I have to find the root element of it using xpath am using mule ESB so I need to set this root element as variable so anyone can provide me xpath for finding the name of the root element
Asked
Active
Viewed 4,196 times
4 Answers
6
This should work.
name(/*)
sample XML
<the>
<element>hello</element>
</the>
Result
the

stringy05
- 6,511
- 32
- 38
4
in mule you can define the MEL expression as
#[xpath:name(/*)]
to retrieve the root element

Mohan
- 520
- 4
- 16
-
Its was not working but i found the answer with the help of your answer thank you – Satheesh Kumar Feb 25 '15 at 06:18
3
Since xpath was deprecated, xpath3 should be used instead.
Mel example: #[xpath3('name(/*)')]

Tim Marinšek
- 195
- 4
1
The proper MEL expression is #[xpath('xpath:name(/*)')]
The other answers helped me to find the proper answer.Thanks all

Satheesh Kumar
- 797
- 7
- 31