[phpXML] RE: [phpXML] miss-match
Brought to you by:
bs_php,
nigelswinson
From: <wl...@bl...> - 2001-10-08 18:35:00
|
By Using <!CDATA[ any <tagged> text ]] i've modified my xml.php version to detect weather there are html tags or other text that might ruin an xml document structure. modified xml.php included.. // From my previous email to the list Here's a little snippit from the xml.php I modified to accomodate the lack of CDATA creation in a node that contains characters that would otherwise make an XML document invalid. What do you think? Can you improve it? -When I call $xmlobj->get_file(); it will go through the $xmlobj->nodes array and format the XML document. -For every 'text' node it will scan for characters such as "<>&". -If it encounters such characters it will add the <![CDATA[ tag before and ]] tag after the 'text' node. -Else just write out the 'text' node. if (strspn($this->nodes[$root]["text"], "<>&") > 0) { // Add the character data to the XML data with CDATA tags around it. $xml .= $before." <![CDATA[\n"; $xml .= $before." ".$this->nodes[$root]["text"]."\n"; $xml .= $before." ]]>\n"; } else { // Add the character data to the XML data. $xml .= $before." ".$this->nodes[$root]["text"]."\n"; } Look for this comment in your xml.php under the get_file() function if you want to know where i put it. It's around line 355 // Add the character data to the XML data. -----Original Message----- From: rot...@ne... [mailto:rot...@ne...] Sent: Wednesday, July 04, 2001 12:13 AM To: us...@li... Subject: [phpXML] miss-match How can I get around phpXML's tendency to place tags inside regular text after the tag containing the text. i.e., <blah1> Text<blah2>more</blah2>text. </blah> Comes out Text text.more -- This message has been sent through the <phpXML/> user discussion list. To unsubscribe, please visit https://sslsites.de/mailinglisten/user/us...@li.../ |