Diğer yol DomDocument ile ona (Ürün Kodu) var mı?

0 Cevap

Ben example.xml var

 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.02"> 
      <content>

 <books>    
     <book>
  <qty>12</qty>
  <title>C++</title>
     </book>
     <book>
  <qty>21</qty>
  <title>PHP</title>
     </book>    
   </books>    
  </content>
</Document>

(Dosya ile) gibi şu anda ben yaptım

  $xmlFile = file_get_contents("example.xml");
  $xml = str_replace('<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.02"> ', "<Document>", $xmlFile); // This removes ALL default namespaces.
  //echo $xmlFile;
  $fp = fopen('example.xml', 'w');
  fwrite($fp, $xml);
  fclose($fp);
  //TODO MORE AFTER IT

Are there other way(Remove the xmlns) to it with DOMDOcument? Because I am using read/write file.

0 Cevap