Steve Hougom
asked on
parsing xml in javascript
I was wondering how to parse out the following values in the "title" tag in the xml using javascript.
Its some xml I get back from a sharepoint list. I want to put them in some sort of container I can us for binding or displaying.
Values are:
orange,
peach,
cherry
And put them in some sort of container I can use later.
Thanks
Its some xml I get back from a sharepoint list. I want to put them in some sort of container I can us for binding or displaying.
Values are:
orange,
peach,
cherry
And put them in some sort of container I can use later.
<?xml version="1.0" encoding="utf-8"?><feed xml:base="https://somesite/sites/cs/_api/" xmlns="http://
www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://
schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://
www.opengis.net/gml"><id>bd62831a-2c0f-4118-9268-e3dfff241615</id><title /><updated>2016-03-09T14:41:07Z</
updated><entry m:etag=""4""><id>Web/Lists(guid'cece37e3-206b-4021-8c2b-f91c41c62602')/Items(1)</
id><category term="SP.Data.POC_x005f_FruitListItem" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/
scheme" /><link rel="edit" href="Web/Lists(guid'cece37e3-206b-4021-8c2b-f91c41c62602')/Items(1)" /><title /
><updated>2016-03-09T14:41:07Z</updated><author><name /></author><content type="application/
xml"><m:properties><d:Title>Orange</d:Title></m:properties></content></entry><entry m:etag=""3""><id>Web/
Lists(guid'cece37e3-206b-4021-8c2b-f91c41c62602')/Items(2)</id><category term="SP.Data.POC_x005f_FruitListItem"
scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" href="Web/
Lists(guid'cece37e3-206b-4021-8c2b-f91c41c62602')/Items(2)" /><title /><updated>2016-03-09T14:41:07Z</
updated><author><name /></author><content type="application/xml"><m:properties><d:Title>Apple</d:Title></
m:properties></content></entry><entry m:etag=""1""><id>Web/Lists(guid'cece37e3-206b-4021-8c2bf91c41c62602')/
Items(3)</id><category term="SP.Data.POC_x005f_FruitListItem" scheme="http://schemas.microsoft.com/
ado/2007/08/dataservices/scheme" /><link rel="edit" href="Web/Lists(guid'cece37e3-206b-4021-8c2b-f91c41c62602')/
Items(3)" /><title /><updated>2016-03-09T14:41:07Z</updated><author><name /></author><content type="application/
xml"><m:properties><d:Title>Peach</d:Title></m:properties></content></entry><entry m:etag=""1""><id>Web/
Lists(guid'cece37e3-206b-4021-8c2b-f91c41c62602')/Items(4)</id><category term="SP.Data.POC_x005f_FruitListItem"
scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" href="Web/
Lists(guid'cece37e3-206b-4021-8c2b-f91c41c62602')/Items(4)" /><title /><updated>2016-03-09T14:41:07Z</
updated><author><name /></author><content type="application/xml"><m:properties><d:Title>Cherry</d:Title></
m:properties></content></entry></feed>
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Im even just trying to get the first occurrence and this spits out nothing. (I know I need a for loop)
function myFunction(xml) {
var xmlDoc = xml.responseXML;
var test;
//document.getElementById(
test = xmlDoc.getElementsByTagNam
alert(test);
}