hi Russ,

why don't you just str_replace the <, > and & with their entities and when they get extracted the parser will normally replace them with their original form, won't it?

Regards,
Khalid Al-Kary





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 "&#60;">
<!ENTITY gt "&#62;">
<!ENTITY amp "&#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...

Jim

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

Hello Jim Russ &

becomes...

&

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

Russ



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

_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus


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

Reply via email to