The XML document Format used in this article
SAX parsing XML data is a row-by-row resolution , unlike DOM's way of adding an entire document to memory resolution ,
SAX parsing using the NSParser(Apple's own framework ) DOM relies on GData ( google dev )
SAX Parsing Data principle : event -driven, each element is found to notify the agent , in the proxy method will find the elements encapsulated stored in the dictionary , we walk through the dictionary to find each element , stored in the data source array after modeling
The SAX parsing code for this XML document is given below, and the rest of the code is the same as the Previous few articles
SAX parsing commonly used proxy methods :(are proxy methods , the parser discovers a data to notify the corresponding agent method , event-driven )
The execution order of the methods is printed in pairs, and the discovery document corresponds to the End document, and the element is found to correspond to the end of the element.
Execute the appropriate code in the appropriate way, depending on the situation and the needs of the selection . The previous article chose didstartelement to implement the data modeling operation and found a sub-element ( video) with element (VIDEOS) creates a model , passes the data, and adds it to the array . how many arrays of video elements in the XML document correspond to the lengths of
Here's a separate way to say this :
The other parameters in this method do not know what to do , only to find that the dictionary has the data we need
This article uses the XML form, this article uses the method is didstartelement, This method notifies the agent when the parser discovers the element , the automatic invocation , we can get the value of the property with the element at this time ,
This is the XML data to be used in the next article , and we need to get to the content of the element , not the element ( element attribute ). Be aware of the two forms of XML that distinguish between What data we need , what data elements (attributes) are needed, or meta-content . The format of the document is different, the data we need is locked in a different location, which means that the way we parse it will be different .
XML data parsing (element attributes) Sax Mode Nsparser Proxy