N
N
n-name2016-11-25 14:01:17
PHP
n-name, 2016-11-25 14:01:17

How to access an element in XML using namespace (PHP SimpleXMLElement XPath)?

Good day.
What is the correct way to access elements in XML, if NameSpace is used, with PHP's SimpleXMLElement Xpath?
Fragment

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:export xmlns="http://example.org/oos/types/1" xmlns:ns2="http://example.org/oos/export/1" xmlns:ns3="http://example.org/oos/printform/1">
    <ns2:fcsNotificationEF schemeVersion="6.3">
        <id>123456789</id>

How to correctly make an Xpath request and get access to the id?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2016-11-25
@n-name

php.net/manual/en/simplexmlelement.xpath.php#115957

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question