xml:lang parse in PHP

前端 未结 5 1306
余生分开走
余生分开走 2020-12-10 19:05

  
    
      
        FW&         


        
5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-10 19:39

    Yes, SimpleXML works but try adding the xml namespace if you run into trouble.

    E.g.:

    
    
        
          
            ФВ
            FW
          
          
            УТ
            UT
          
        
    
    XML;
    
    $xml = new SimpleXMLElement($xmlstr);
    
    foreach ($xml->xpath('//data/code[@xml:lang="en"]') as $code) {
        echo $code, '
    ', PHP_EOL; } ?>

提交回复
热议问题