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

Popular posts from this blog

javascript - Unusual behaviour when drawing lots of images onto a large canvas -

how can i manage url using .htaccess in php? -

javascript - Chart.js - setting tooltip z-index -