mercredi 11 octobre 2017

How to access values in nested XML in PHP

I have the following XML string in php and i want to access specific values from that . for eg: how will i extract the values of the title . Below is my XML content.

<record xmlns:xsi="http://ift.tt/ra1lAU" xsi:schemaLocation="http://ift.tt/1sMy6Fc http://ift.tt/1wDzy1b" xmlns="http://ift.tt/1sMy6Fc">
  <leader>01118cam a22003497i 4500</leader>
  <controlfield tag="001">18475363</controlfield>
  <controlfield tag="005">20151007123810.0</controlfield>
  <controlfield tag="008">141017s2014    ii            000 f eng d</controlfield>
  
  <datafield tag="245" ind1="1" ind2="0">
    <subfield code="a">Half girlfriend /</subfield>
    <subfield code="c">Chetan Bhagat.</subfield>
  </datafield>
  <datafield tag="264" ind1=" " ind2="1">
    <subfield code="a">New Delhi :</subfield>
    <subfield code="b">Rupa,</subfield>
    <subfield code="c">2014.</subfield>
  </datafield>
  </record>

For eg: How am i supposed to get "Half girlfriend" or "New Delhi". Any help is appreciated.

Aucun commentaire:

Enregistrer un commentaire