Code example for Element

Methods: getElementsByTagName, getFirstChild, insertBefore

0
 
	return false; 
    } 
 
    public void setVersion(int minSdkVersion, int targetSdkVersion, int maxSdkVersion) {
	Element sdk = (Element) root.getElementsByTagName("uses-sdk").item(0);
	if (sdk == null) {
	    sdk = document.createElement("uses-sdk");
	} 
	sdk.setAttribute("android:minSdkVersion", Integer.toString(minSdkVersion));
	sdk.setAttribute("android:targetSdkVersion", Integer.toString(targetSdkVersion));
	sdk.setAttribute("android:maxSdkVersion", Integer.toString(maxSdkVersion));
 
	root.insertBefore(sdk, root.getFirstChild());
    } 
 
    public void addPermission(String permission) {
	if (hasPermission(permission))
	    return; 
 
	Element permissionElement = document.createElement("uses-permission");