Jquery – How to access xml text node in Jquery

jqueryxml

Suppose I get the following XML structure:

<root>
<item>
 <item1>text1</item1>
 <item2>text2</item2>
 more text here
</item>
</root>

"more text here" is a text node that is at the same level as the other data nodes in the hierarchy but it does not seem to be accessible.

Is there a way of extracting the text node shown above using jQuery functions?

Best Solution

I came up with the same solution:

  var xml = $("<root><item1>text1</item1><item2>text2</item2>more text here</root>");
  alert($(xml).contents().empty().end().text());