Just thought of a workaround for this: use   instead of a space - e.g.
"Tom & Jerry" - 'trim' doesn't realise it's a space, so does
nothing with it. Makes the xml file more unreadable, but does the trick.
how to fool php . . .
On Sunday 08 July 2001 11:46, I wrote:
> On Saturday 07 July 2001 20:29, you wrote:
> > Hello,
> >
> > I have the following in an XML file:
> >
> > <title>DTD's & schema</title>
> >
> > Using <phpXML/>, I extract that string using get_content() and
> > display it on a web page. For some reason, the spaces around the
> > ampersand are removed.
> >
> > Does someone have a fix for this? Any help would be really
> > appreciated.
>
> This is because the parser treats entities like & as separate elements
> and passes them separately through the character data handler. Because
> phpxml trims all strings in its handler, entities also get trimmed. There
> is a similar problem with the embedded nodes we've been discussing
> (<text>brave <ex>new</ex> world</text>). It needs to do some trimming to
> get rid of carriage returns, tabs, etc in the file, but I rather think
> instead of getting rid of all of them, it would be better to replace large
> amounts of whitespace with one space. Alternatively, only trim spacing at
> the beginning and end of nodes, not in the middle. Curiously php has a
> (undocumented) SKIP_WHITE option which is used in the parse_into_struct
> example, but this doesn't seem to have any effect in the ordinary parse.
>
> > Also, there is a bug on line 125: "&apos" should be "'". To
> > make things more troublesome, it looks like Internet Explorer (at
> > least mine!) doesn't recognize ' but will recognize '.
>
> solution: don't use IE! (or simply use ' instead)
>
> --
> 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.../
|