Android Question Test to validate HTML code ?

William Hunter

Active Member
Licensed User
Longtime User
I am getting incomplete HTML messages as processed by the Mailparser. Is there a way to validate that HTML code is complete/or incomplete. I would like to trap invalid HTML as an error, prior to loading to a WebView. Any help greatly appreciated.

Best regards :)
 

William Hunter

Active Member
Licensed User
Longtime User
Validating html is a very complicated issue. You can check whether the message includes the closing </html> tag.
Thank you Erel. I’m finding that trying to load ALL emails received into a WebView to be a daunting tast. I tried your <html> suggestion and find it to be hit and miss. There are some content types/encoding that the Mailparser cannot process correctly. I can, with a few unwanted characters such as =0A stripped out, display acceptably about 85% of messages received. Others come through the Mailparser malformed, or occasionally stripped to a 0 bytes file.

When I started I thought this would be a fairly straightforward task, but it turns out not to be so. I think the only way to resolve this issue, would be to update the Mailparser to process all current formats. I don’t know whether this would be easily accomplished, or be a major undertaking. I don’t have the knowledge to do this, otherwise I would give it a try. Erel, perhaps if I have caught you on a good day, you will put your considerable skills to the task. I’m sure a great many of us would appreciate an upgraded Mailparser.

I have attached three examples of malformed HTML as processed by the Mailparser. Two are missing <html>, while the third includes <html> with a trailing <.

Best regards :)
 

Attachments

  • RawBodyMicheals.txt.txt
    657 bytes · Views: 119
  • RawBodyTalbots.txt
    1.1 KB · Views: 140
  • RawBodyClassmates.txt
    140 bytes · Views: 130
Upvote 0
Top