Android XML Parsing using DOM ParserWe can parse the xml document by dom parser also. It can be used to create and parse the xml file. Advantage of DOM Parser over SAXIt can be used to create and parse the xml file both but SAX parser can only be used to parse the xml file. Disadvantage of DOM Parser over SAXIt consumes more memory than SAX. Example of android DOM Xml parsingactivity_main.xmlDrag the one textview from the pallete. Now the activity_main.xml file will look like this: File: activity_main.xml xml documentCreate an xml file named file.xml inside the assets directory of your project. File: file.xml Activity classLet's write the code to parse the xml using dom parser. File: MainActivity.java Output:Next TopicAndroid XMLPullParser Tutorial |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India