6

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

Satheesh Kumar
  • 797
  • 7
  • 31

4 Answers4

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
3

Since xpath was deprecated, xpath3 should be used instead.

Mel example: #[xpath3('name(/*)')]

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