1. Import third-party plugins (Gdalaxmlnode) 2. Third-party plug-in configuration libxml/tree.h Path Search in the project properties--bulid settings --search Paths--headr Search Paths Add path (/USR/INCLUDE/LIBXML2) Non-Arc --bulid phases in the project properties --compile Sources in--gdataxmlnode.m add parameter (-FNO-OBJC-ARC) third-party library file loading --bulid phases in the project properties--link binary with LIBRAIES--LIBXML2 file 3. Using third-party plugins //Set URL Nsurl * url=[nsurl urlwithstring:@ "XML remote Path"]; //Session nsurlsession * session=[nsurlsession sharedsession]; //Tasks nsurlsessiondatatask * task=[session datataskwithurl:url completionhandler:^ () { }]; //Task start [Task resume]; //Data Security Configuration info.plist---OPen as--source Code Add <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict> Import third-party libraries #import "GDataXMLNode.h" Document-based parsing //Create a document gdataxmldocument * Doc =[[gdataxmldocument alloc] initwithdata:data options:0 Error:nil]; if (doc) { //Get root element gdataxmlelement *rootelement=doc.rootelement; //Fast traversal For (gdataxmlelement * student in Rootelement.children) { For (gdataxmlelement * student.children) { NSLog (@ "%@,%@", Property.name,proparey.stringvalue): } } }else{ }
Third-party parsing XML for XML parsing of IOS-database network