php - SimpleXML access separated text nodes -
i have xml file following:
... <myelement>introduction:<br /> ... </myelement> ...
are there way return "introduction:" , rest after </br>
of element?
i using php , simplexml. naively use echo $document->myelement
shows "introduction:...", mixed introduction line , content.
simplexml not have concept of text-nodes might know domdocument (see this comparison table).
so in php option import <myelement>
element dom , operation there:
# prints "introduction:" echo dom_import_simplexml($myelement)->firstchild->data; // ^ // `- domtext
Comments
Post a Comment