Re: Issue with NSXMLDocument and bad HTML
Re: Issue with NSXMLDocument and bad HTML
- Subject: Re: Issue with NSXMLDocument and bad HTML
- From: Andy Lee <email@hidden>
- Date: Tue, 18 Oct 2005 18:27:44 -0400
On Oct 18, 2005, at 4:51 PM, John Stiles wrote:
Actually, I think it is malformed. It claims to be XHTML, but
contains JavaScript that is not inside a comment block. Look for
"adPosTop". It's valid HTML, but that's not really the same thing.
That was just the first thing I found; it could be malformed in
lots of other creative ways as well :)
I wouldn't use an XML parser to parse someone else's HTML -- even
HTML that promises to be XHTML. I just don't trust anybody (even
myself) to write perfect XHTML. I would either write my own parser
or find something that's specifically designed to be an HTML parser,
and to deal with imperfections. Maybe there's something in the Omni
libraries you could use, or some other open-source browser code. For
Java I know there's something called TagSoup which a coworker has
used very successfully.
On the other hand, I vaguely remember asking if NSXMLParser could be
used with HTML that is not well-formed XML, and I *thought* the
answer was yes, but I don't see how. I see there are delegate
methods for handling errors, but the errors always seem to be fatal,
which means you can't recover in some forgiving way.
--Andy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden