On Mon, Jan 27, 2003 at 09:33:38AM -0800, Josh Chamas wrote: > do some runtime XML validation like running it through XML::Simple > in an eval {} or something to catch the error, so that users are > warned that they need to input properly escaped XHTML.
If the users are not programmer types, I'm thinking for the sake of usability, the application should probably give the user the option of having his invalid XML automatically fixed for him, using an algorithm maybe like this: 1. If a tag is being closed, but it's not the one you expect to be closed, then close the one(s) you expect to be closed first. 2. If a tag is being closed that was never opened, then discard the closing tag. 3. If any tags are unclosed at the end of the document, close them. The above algorithm would change <b><i>test</b></i> to <b><i>test</i></b>, which is what one would expect. The above could be accomplished by running the document through some sort of HTML or XML parser (there are some CPAN modules for this). --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]