Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Distinguish between HTML and Plain text

by JavaFan (Canon)
on Sep 27, 2011 at 01:10 UTC ( #927991=note: print w/ replies, xml ) Need Help??


in reply to Distinguish between HTML and Plain text

You cannot. Remember that the content of P elements can consist of just PCDATA. Which can just be "plain text". And even if you have a piece of data that validates against an HTML DTD, you still cannot know whether the author intended it as HTML, or as plain text.

If you need to know, you either have to use some heuristics (for instance, it "validates", either against a DTD or the more usual "my browser doesn't barf on it"), or ask the user.


Comment on Re: Distinguish between HTML and Plain text

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://927991]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (10)
As of 2014-12-18 23:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (69 votes), past polls