views:

214

answers:

1

I'm trying to parse HTML data using KissXML for iphone. I've noticed that I can't have dashes in the id() tag, otherwise it won't evaluate. For example, if I'm trying to get the element at I would do

id("foo")

However, if I try to get at element , and I try

id("foo-bar")

the libxml2 XPATH engine doesn't seem to return anything. It works using the XPATH check for firefox, though. Anyone run into this issue and know of a reason why it's happening or have a workaround (besides using the absolute XPATH path?)

A: 

I don't know much about KissXML or your project. If you are only doing some light Xpath queries I suggest you just try this:

http://cocoawithlove.com/2008/10/using-libxml2-for-parsing-and-xpath.html

It's basically 2 methods

NSArray *PerformXMLXPathQuery(NSData *document, NSString *query); NSArray *PerformHTMLXPathQuery(NSData *document, NSString *query);

I had a lot of easy success with this method.

Bryan Clark
Hey Bryan,Yea I originally went with that method but I found KissXML to give me much cleaner code in the end since it pretty much conforms to Apple's NSXMLDocument classes.