parse data from xml response

RESTful knowledge exchange

parse data from xml response

Veeam Logoby sirinech » Mon Apr 21, 2014 11:12 am

Hello I would like to know how to get the info from an xml file when the tag contains more than one attribute like in this case: I send request to get backupSessions I get xml file with a lot of ref tags , how to select one ref and its link tags based on the name attribute in the ref tag:

<Ref Href="http://172.19.11.128:9399/api/backupSessions/6fe627e2-59ad-4602-bd0c-2af018ed5c3d" Type="BackupJobSessionReference" UID="urn:veeam:BackupJobSession:6fe627e2-59ad-4602-bd0c-2af018ed5c3d" Name="Backup Job 1@2014-04-10 12:11:04">

<Links>.....</Links>
</Ref>
sirinech
Influencer
 
Posts: 23
Liked: 1 time
Joined: Fri Mar 21, 2014 3:06 pm
Full Name: sirine chadly

Re: parse data from xml response

Veeam Logoby hatari » Mon Apr 21, 2014 2:01 pm 2 people like this post

Hello

Actually it depends on what you using are to parse data.
But typically you should choose node (first, last, all of them) and get attribute you need (Name, Href, UID, etc).
hatari
Novice
 
Posts: 9
Liked: 3 times
Joined: Tue Jun 18, 2013 10:06 am
Full Name: Alexey Rostovskiy

Re: parse data from xml response

Veeam Logoby sirinech » Mon Apr 21, 2014 3:57 pm

any example with php?
sirinech
Influencer
 
Posts: 23
Liked: 1 time
Joined: Fri Mar 21, 2014 3:06 pm
Full Name: sirine chadly

Re: parse data from xml response

Veeam Logoby hatari » Tue Apr 22, 2014 8:19 am

Try this one - post81669.html
hatari
Novice
 
Posts: 9
Liked: 3 times
Joined: Tue Jun 18, 2013 10:06 am
Full Name: Alexey Rostovskiy

Re: parse data from xml response

Veeam Logoby hatari » Fri Apr 25, 2014 12:09 pm

Sirine, you can also check examples with php in “(EM install dir)\samples" folder: there are 6 typical action like StartJob, AddVmToJob, etc, plus generated php classes from xsd.
hatari
Novice
 
Posts: 9
Liked: 3 times
Joined: Tue Jun 18, 2013 10:06 am
Full Name: Alexey Rostovskiy


Return to RESTful API



Who is online

Users browsing this forum: No registered users and 2 guests