Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issue with NSXMLDocument and bad HTML



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Issue with NSXMLDocument and bad HTML (From: Tito Ciuro <email@hidden>)
 >Re: Issue with NSXMLDocument and bad HTML (From: Brian Stern <email@hidden>)
 >Re: Issue with NSXMLDocument and bad HTML (From: John Stiles <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.