I have some XML string output which looks like the following:
<xml>
<node>
<Title name="Title">Tea and Coffee</Title>
<Menu-Item name="Menu-Item">
<div class="field-item field-item-0">Freshly brewed fairtrade filter coffee and a selection of fairtrade tea and herbal infusions</div><div class="field-item field-item-1">Ut laoreet porta tellus, ut pellentesque ipsum dictum metus.</div>
</Menu-Item>
</node>
</xml>
The next thing I need to do is extracting the ‘div’ elements and casting them so I can use them as jquery objects as normal.
Any ideas?
Let us say you have this as a text string in a variable named myxml. Then you read it with jquery, as follows:
The alert is only meant to show how you can get the inner text. Here’s a post that can help you with more examples: reading-xml-with-jquery