Skip to main content
8-Gravel
October 28, 2022
Solved

Need to retrieve the attributes of nodes in XML using Xpath

  • October 28, 2022
  • 2 replies
  • 1027 views

Hi everyone, i have xml input. I need to retrieve all the attributes of the specific node .thanks in advance 

Best answer by VladimirRosu_116627

Whenever I need to parse XML, I use the built-in E4X framework to access what I need.

For example, if I need to retrieve the name attribute, I use this syntax:

result = result_XML.*::["XMI.content"].UML::Model[0].@name

There are various other accessors,all described here: https://svn.wso2.org/repos/wso2/tags/carbon/0.1alpha/mashup/java/xdocs/e4xquickstart.html

I always use this approach because I do not like to depend on other extensions, especially when there is a built-in capability in the platform to do that.

The E4X framework is not exactly something extremely easy to understand, but also not a huge task - hence I suggest trying this.

2 replies

5-Regular Member
October 30, 2022

Hello @KT_10107318 

 

Pls check the attached article and let me know if it works for you:

https://www.ptc.com/en/support/article/cs308188

 

Regards

Bhawna

19-Tanzanite
November 3, 2022

Whenever I need to parse XML, I use the built-in E4X framework to access what I need.

For example, if I need to retrieve the name attribute, I use this syntax:

result = result_XML.*::["XMI.content"].UML::Model[0].@name

There are various other accessors,all described here: https://svn.wso2.org/repos/wso2/tags/carbon/0.1alpha/mashup/java/xdocs/e4xquickstart.html

I always use this approach because I do not like to depend on other extensions, especially when there is a built-in capability in the platform to do that.

The E4X framework is not exactly something extremely easy to understand, but also not a huge task - hence I suggest trying this.