SWIFT XPath (How2 Parse/Scrape HTML/XML)

Solution Approaches

There are two possible solutions: Using the native libxml2 lib or going for an open source framework. In the following I discussed both aproaches.

"Native" libary (libxml2.)

Using the libxml2 library (http://xmlsoft.org) which is available in iOS:

Advantages

  • It's available per default in iOS

Disadvantages

Third Party Frameworks

Open sources frameworks/wrapper:

Advantages

  • You just add the framework and you can start using it

Disadvantages

  • No learnings
  • Third party license

Available Frameworks

Conclusion

  • The most common third party frameworks are all wrapper for libxml2
  • An HTML parser that can show a value vor an XPath can be easily implemented by one self

-> I will go for a DIY solution (If you don’t want to go for a own implementation, one of the frameworks mentioned above will be a good solution)

Sources