[phpXML] RE: [phpXML] Re: [phpXML] miss-match
Brought to you by:
bs_php,
nigelswinson
From: <wl...@bl...> - 2001-10-08 17:23:57
|
<blah1> Text<blah2>more</blah2>text. </blah> Just wondering if this is a correct xml data structure. Cause I haven't seen somthing like this before. Or is this an output from phpXML? Can you be a little bit more clear on this because i haven't encountered major problems from phpXML except when I start using complex XPath. I can easily write an xmlfile and read from an xmlfile but haven't tested the replace and delete node. WiL -----Original Message----- From: Ni...@Sw... [mailto:Ni...@Sw...] Sent: Wednesday, July 04, 2001 5:20 AM To: us...@li... Subject: [phpXML] Re: [phpXML] miss-match > -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"; > } I'm not sure that this actually solves the stated problem though as I think I am right in saying that this is a fix that goes into get_file(). Therefore if the datastructure can't describe "Before<tag>Middle</tag>End", then it's not going to be able to print it. This fix will cope with usage of the object that make calls to set_content("address","Some text <B>that</B> contains some markup."). But if the xml file that you read in already has "Some text <B>that</B> contains some markup." then the class is going to loose this structure in the parse. Basically phpxml's internal datastructure is lossy. You can't read to object and write back out to file and have two logically identical files. Ideally it ought to be. We need a more complete fix for this in the constructor or load_from_file function I think.... Nigel > 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.../ -- This message has been sent through the <phpXML/> user discussion list. To unsubscribe, please visit https://sslsites.de/mailinglisten/user/us...@li.../ |