how to catch an array of nodes to a property

爱⌒轻易说出口 提交于 2019-12-24 07:17:21

问题


Can any one please let me know how can I access an array of elements to a property.

For example: I have an XML as said below

<a>
 <x>1</x>
 <x>2</x>
 <x>3</x>
 <x>4</x>
</a>

I want my property to be set as shown below:

 <x>1</x>
 <x>2</x>
 <x>3</x>
 <x>4</x>

when I try to access using //x with property type set to OM element or String I don't see the result as expected in my property.

Can any one please direct me with the right xpath to be used to see the desired outcome ?


回答1:


You should be able to use //a/child::node() XPath for this.

Please refer XPath to get all child nodes (elements, comments, and text) without parent

Hope this helps!!

/Harshana



来源:https://stackoverflow.com/questions/12732541/how-to-catch-an-array-of-nodes-to-a-property

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!