how to read the multiple xml contents in a file using php

前端 未结 3 723
轻奢々
轻奢々 2021-01-26 10:28

I\'m dealing with this kind of XML sequence file can you any one suggest me to parse this:




        
3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-26 10:34

    That's not a valid XML file. It looks like two files in one, but even then it is invalid. Assuming those are two separate files, you could try "tidying" them first. Assuming $xml is a string containing the xml contents:

    $xml = tidy_repair_string($xml, array(
        'output-xml' => true,
        'input-xml' => true
    )); 
    

    Then you could use SimpleXml on it:

    $xml = new SimpleXmlElement($xml);
    

提交回复
热议问题