Created
June 4, 2013 05:25
-
-
Save Anjali2019/5703782 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import org.w3c.dom.Document; | |
import javax.xml.parsers.DocumentBuilder; | |
import javax.xml.parsers.DocumentBuilderFactory; | |
import javax.xml.parsers.ParserConfigurationException; | |
import org.w3c.dom.Element; | |
import org.w3c.dom.Node; | |
import org.w3c.dom.NodeList; | |
public class checkmanifest { | |
static boolean wakelock; | |
checkmanifest() | |
{ | |
wakelock=false; | |
} | |
public static void main(String args[]) | |
{ | |
try { | |
check(); | |
} catch (ParserConfigurationException e) { | |
// TODO Auto-generated catch block | |
e.printStackTrace(); | |
} | |
} | |
static void check() throws ParserConfigurationException | |
{ | |
int a; | |
a=1; | |
wakelock=true; | |
try | |
{ | |
File fXmlFile = new File("/home/anjali/Documents/mtp/apps/Untitled1Folder/Google Maps 6.14.3 (androidfullapps.com)/AndroidManifest.xml"); | |
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); | |
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); | |
Document doc = dBuilder.parse(fXmlFile); | |
doc.getDocumentElement().normalize(); | |
System.out.println("Root element :" + doc.getDocumentElement().getNodeName()); | |
NodeList nList = doc.getElementsByTagName("uses-permission"); | |
for (int temp = 0; temp < nList.getLength(); temp++) | |
{ | |
Node nNode = nList.item(temp); | |
// System.out.println("\nCurrent Element :" + nNode.getNodeName()); | |
if (nNode.getNodeType() == Node.ELEMENT_NODE) { | |
Element eElement = (Element) nNode; | |
System.out.println("Staff id : " + eElement.getAttribute("android:name")); | |
// System.out.println("First Name : " + eElement.getElementsByTagName("firstname").item(0).getTextContent()); | |
} | |
} | |
nList = doc.getElementsByTagName("activity"); | |
for (int temp = 0; temp < nList.getLength(); temp++) | |
{ | |
Node nNode = nList.item(temp); | |
System.out.println("\nCurrent Element :" + nNode.getNodeName()); | |
if (nNode.getNodeType() == Node.ELEMENT_NODE) { | |
Element eElement = (Element) nNode; | |
System.out.println("Staff id : " + eElement.getAttribute("android:name")); | |
// System.out.println("First Name : " + eElement.getElementsByTagName("firstname").item(0).getTextContent()); | |
} | |
} | |
nList = doc.getElementsByTagName("service"); | |
for (int temp = 0; temp < nList.getLength(); temp++) | |
{ | |
Node nNode = nList.item(temp); | |
System.out.println("\nCurrent Element :" + nNode.getNodeName()); | |
if (nNode.getNodeType() == Node.ELEMENT_NODE) { | |
Element eElement = (Element) nNode; | |
System.out.println("Staff id : " + eElement.getAttribute("android:name")); | |
// System.out.println("First Name : " + eElement.getElementsByTagName("firstname").item(0).getTextContent()); | |
} | |
} | |
nList = doc.getElementsByTagName("receiver"); | |
for (int temp = 0; temp < nList.getLength(); temp++) | |
{ | |
Node nNode = nList.item(temp); | |
System.out.println("\nCurrent Element :" + nNode.getNodeName()); | |
if (nNode.getNodeType() == Node.ELEMENT_NODE) { | |
Element eElement = (Element) nNode; | |
System.out.println("Staff id : " + eElement.getAttribute("android:name")); | |
// System.out.println("First Name : " + eElement.getElementsByTagName("firstname").item(0).getTextContent()); | |
} | |
} | |
nList = doc.getElementsByTagName("provider"); | |
for (int temp = 0; temp < nList.getLength(); temp++) | |
{ | |
Node nNode = nList.item(temp); | |
System.out.println("\nCurrent Element :" + nNode.getNodeName()); | |
if (nNode.getNodeType() == Node.ELEMENT_NODE) { | |
Element eElement = (Element) nNode; | |
System.out.println("Staff id : " + eElement.getAttribute("android:name")); | |
// System.out.println("First Name : " + eElement.getElementsByTagName("firstname").item(0).getTextContent()); | |
} | |
} | |
} | |
catch(Exception e) | |
{ | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment