Execute a XQuery with PHP

前端 未结 8 837
青春惊慌失措
青春惊慌失措 2020-11-30 13:02

How to execute a XQuery in PHP? Can you give me an example?

Thank you.

8条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-30 13:15

    its also posible with DOMDocument and DOMXPath

    $doc = new DOMDocument();
    $doc->load('http://www.example.com/some.xml');
    $xpd = new DOMXPath($doc);
    false&&$node = new DOMElement();//this is for my IDE to have intellysense
    
    $result = $xpd->query('//a/b');
    foreach($result as $node){
        echo $node->nodeName.'
    '; }

提交回复
热议问题