honghaoz / Ji

Ji (戟) is an XML/HTML parser for Swift
MIT License
824 stars 65 forks source link

Does library support concat and another logical operations? #20

Closed Arti3DPlayer closed 8 years ago

Arti3DPlayer commented 9 years ago

Have troubles with queries that contains logical operations. They always return empty results.

honghaoz commented 9 years ago

Hi @Arti3DPlayer, it should support logical operations, could you please provide an example?

Arti3DPlayer commented 9 years ago

For example at this page:

http://www.homedepot.com/p/Arnold-Universal-Snow-Thrower-Key-Set-4-Piece-490-241-0008/202251530?keyword=4902410008

concat(//*[@id='ajaxPrice']/text(), //*[@id='ciItemPrice']/text())

let jiDoc = Ji(htmlData: responseData)!
                                    let titleNode = jiDoc.xPath(text)
                                    print(titleNode)
Arti3DPlayer commented 9 years ago

i found the solution i guess. This is because i return string, not dom element :( Is there a solution, how to make it works ?

honghaoz commented 9 years ago

@Arti3DPlayer Hey what the solution you found? I tried concat and it doesn't work. Not sure whether it's syntax problem or internal problem. I'll continue to figure it out

Arti3DPlayer commented 9 years ago

oh, you don't understand me. I mean that i found the issue ) I tried:

https://github.com/tid-kijyun/Kanna https://github.com/topfunky/hpple

No one is working with strings. My question at stackoverflow: http://stackoverflow.com/questions/33353848/swift-xpath-search-return-string

honghaoz commented 9 years ago

Based on libxml2.0 C library, not NSXMLParser.

Arti3DPlayer commented 9 years ago

Yes but issue in code :( Because i have tested at Python libxml library, it works