How to retrieve X path(not the value) from an XML file.

Certified Senior Developer

Hi people,

I have requirement where i need to find the X path of an XML file. We have functions to retrieve a value using the X path. But our requirement is retrieve the X path instead of the value, So that the user will use that and cross verify the xml file whether its matching. Here is an example.

Input:

<Document>
<customer>
<details>
<name>xyz</name>
<address>abc</address>
<contact>
<phone>45667778</phone>
<employee>
<company>
<department>
<id>6786</id>
</department>
</company>
</employee>
</contact>
</details>

</customer>
</Document>


Output:

for Retrieving the name XYZ this would be the X path

"<Document><customer><details><name>" this is actual output we require

And this is the output we need for nested X path.

"<Document><customer><details> <contact><employee><company><department><id>"

  Discussion posts and replies are publicly visible

Parents Reply Children