mercredi 11 octobre 2017

add attribute with colon to xml node in php

I have an xml value in the php variable and i need to add the attribute xsi:schemaLocation="http://ift.tt/1sMy6Fc http://ift.tt/1wDzy1b" and xmlns="http://ift.tt/1sMy6Fc" on the 'record' element . Below is my xml in php

<record xmlns="http://ift.tt/1sMy6Fc">
  <leader>01344cam a2200385 i 4500</leader>
  <controlfield tag="001">19196211</controlfield>
  <controlfield tag="005">20160810165833.0</controlfield>
  <controlfield tag="008">160728t20162015nyu           000 1 eng  </controlfield>
  <datafield tag="906" ind1=" " ind2=" ">
    <subfield code="a">7</subfield>
    <subfield code="b">cbc</subfield>
    <subfield code="c">orignew</subfield>
    <subfield code="d">2</subfield>
    <subfield code="e">ncip</subfield>
    <subfield code="f">20</subfield>
    <subfield code="g">y-gencatlg</subfield>
  </datafield>
</record>

Other characters are working in the place of colon , but colon is not working . I know it's got something related to namespaces but i cant figure out the problem . Any help is appreciated.




Aucun commentaire:

Enregistrer un commentaire