Thursday, 24 September 2015

Xml Parsing Using SAX Parser

Hello Friends,

Today I explain about Xml Parsing in android app.

Xml Parsing is used for parse the data from server and display into our applications. There are 3 types of  Parsers available in Xml.

i) DOM Parser
ii) Sax Parser
iii) XmlPull Parser

DOM Parser: DOM paser means Document Object Module. DOM parser is parsing the data faster if xml is small. If you have to parse large amount of data from xml then it needs more memory and due to need more memory sometimes you will get Out of Memory error. DOM Parser is parsing whole document using xml.

DOM parser have more chances that it will take a long time or even may not be able to load it completely simply because it requires lot of memory to create XML Dom Tree

Sax Parser: Sax Parser means Simple Api For Xml Parsing. This parser is an event based XML Parsing and it parse XML file step by step. SAX XML parser is used for parsing large xml files in Java because it doesn't require to load whole XML file in Java and it can read a big XML file in small parts.

XmlPull Parser: Android recommends to use XMLPullParser to parse the xml file compare to SAX and DOM because it is fast. XmlPull Parser is parsing data from xml using its Start Tag, Text and End Tag.

Here I provide a full code for Sax Parser.

Output:



























Download Full Source Code From Here: XmlParsing

Happy Coding...!!!

No comments:

Post a Comment