[phpXML] Re: [phpXML] miss-match
Brought to you by:
bs_php,
nigelswinson
From: <nig...@us...> - 2001-10-09 13:11:14
|
> -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. >=20 >=20 > if (strspn($this->nodes[$root]["text"], "<>&") > 0) { > // Add the character data to the XML data with CDATA tags around it. > $xml .=3D $before." <![CDATA[\n"; > $xml .=3D $before." ".$this->nodes[$root]["text"]."\n"; > $xml .=3D $before." ]]>\n"; > } else { > // Add the character data to the XML data. > $xml .=3D $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 >=20 > 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.../ |