G
G
Gennady Uvarov2019-07-18 04:47:33
PHP
Gennady Uvarov, 2019-07-18 04:47:33

How to get to the value of an XML element if there is a prefix (:) in it?

You need to get the value of the f:length XML element from the following code.
(The colon interferes. Escaping with a slash does not work.)

<f:table>
   <f:name>Африканский кофейный столик</f:name>
   <f:width>80</f:width>
   <f:length>120</f:length>
</f:table>

in php I write the following line:
$smpl_xml=simplexml_load_file($dirLocal.$value);
       
$nado_length = $smpl_xml->f:table->f:length;

Works if there is no colon:
$nado_length = $smpl_xml->ftable->flength;
How can you escape ":" ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2019-07-18
@Rsa97

https://stackoverflow.com/questions/595946/parse-x...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question