Hi all,

I'm writing a guestbook and message in the guestbook might contain & < > so
to make sure this wasn't a problem I was advised to great entities in my xml
file like so

<!DOCTYPE guestbook [
 <!ELEMENT message (name, email, date, text)>
 <!ATTLIST message  id  CDATA #REQUIRED>
 <!ELEMENT name (#PCDATA)>
 <!ELEMENT email (#PCDATA)>
 <!ELEMENT date (#PCDATA)>
 <!ELEMENT text (#PCDATA)>
 <!ENTITY lt     "&#38;#60;">
 <!ENTITY gt     "&#38;#62;">
 <!ENTITY amp    "&#38;#38;">

and when I write to my xml file if I convert all & < > characters to &amp;
&lt; &gt; problem solved.

I'm having trouble though. My guestbook works fine until you enter a  < > &
character. This will get written to the xml file, writes fine, I can view
the file in a text editor and it looks good.

Parse the file back in and say the field contained...

Hello Russ & Jim

the parser would only hold...


when it writes to the array I parse into. Another example...

Hello Jim Russ &



so basically if a field holds an entity the last element of the field (be it
text after an entity or an entity itself) is the only part parsed.

Makes no sense to me :( I would upload my source and xml file for you to
check but they are big and ugly and you won't want to.

Thanks very much


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to