Source:
public void testMultipleAttributesRemoval ( ) throws java.io.IOException , javax.xml.parsers.ParserConfigurationException , org.xml.sax.SAXException { java.lang.String higherPriority = "" + ( ( ( ( ( ( ( ( "<manifest\n" + " xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" ) + " xmlns:tools=\"http://schemas.android.com/tools\"\n" ) + " package=\"com.example.lib3\">\n" ) + "\n" ) + " <activity android:name=\"activityOne\"\n" ) + " tools:remove=\"theme, exported\"/>\n" ) + "\n" ) + "</manifest>" ) ; java.lang.String lowerPriority = "" + ( ( ( ( ( ( ( ( ( "<manifest\n" + " xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" ) + " xmlns:tools=\"http://schemas.android.com/tools\"\n" ) + " package=\"com.example.lib3\">\n" ) + "\n" ) + " <activity android:name=\"activityOne\" \n" ) + " android:exported=\"true\"\n" ) + " android:theme=\"@oldtheme\"/>\n" ) + "\n" ) + "</manifest>" ) ; com.android.manifmerger.XmlDocument refDocument = com.android.manifmerger.TestUtils.xmlDocumentFromString ( new com.android.manifmerger.TestUtils.TestSourceLocation ( getClass ( ) , "higherPriority" ) , higherPriority ) ; com.android.manifmerger.XmlDocument otherDocument = com.android.manifmerger.TestUtils.xmlDocumentFromString ( new com.android.manifmerger.TestUtils.TestSourceLocation ( getClass ( ) , "lowerPriority" ) , lowerPriority ) ; com.android.manifmerger.MergingReport.Builder mergingReportBuilder = new com.android.manifmerger.MergingReport.Builder ( new com.android.utils.StdLogger ( StdLogger.Level.VERBOSE ) ) ; com.google.common.base.Optional < com.android.manifmerger.XmlDocument > result = refDocument.merge ( otherDocument , mergingReportBuilder ) ; assertTrue ( result.isPresent ( ) ) ; com.android.manifmerger.XmlDocument resultDocument = result.get ( ) ; com.google.common.base.Optional < com.android.manifmerger.XmlElement > activityOne = resultDocument.getRootNode ( ) . getNodeByTypeAndKey ( ManifestModel.NodeTypes.ACTIVITY , "com.example.lib3.activityOne" ) ; assertTrue ( activityOne.isPresent ( ) ) ; java.util.List < com.android.manifmerger.XmlAttribute > attributes = activityOne.get ( ) . getAttributes ( ) ; assertEquals ( 1 , attributes.size ( ) ) ; assertTrue ( activityOne.get ( ) . getAttribute ( com.android.manifmerger.XmlNode.fromXmlName ( "android:name" ) ) . isPresent ( ) ) ; }

Target:
public void testDeepAttributeRemoval ( ) throws java.io.IOException , javax.xml.parsers.ParserConfigurationException , org.xml.sax.SAXException { java.lang.String higherPriority = "" + ( ( ( ( ( ( ( ( "<manifest\n" + " xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" ) + " xmlns:tools=\"http://schemas.android.com/tools\"\n" ) + " package=\"com.example.lib3\">\n" ) + "\n" ) + " <activity android:name=\"activityOne\"\n" ) + " tools:remove=\"theme, exported\"/>\n" ) + "\n" ) + "</manifest>" ) ; java.lang.String lowerPriority = "" + ( ( ( ( ( ( ( ( ( "<manifest\n" + " xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" ) + " xmlns:tools=\"http://schemas.android.com/tools\"\n" ) + " package=\"com.example.lib3\">\n" ) + "\n" ) + " <activity android:name=\"activityOne\" \n" ) + " android:screenOrientation=\"landscape\"\n" ) + " android:theme=\"@oldtheme\"/>\n" ) + "\n" ) + "</manifest>" ) ; java.lang.String evenLowerPriority = "" + ( ( ( ( ( ( ( ( ( "<manifest\n" + " xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" ) + " xmlns:tools=\"http://schemas.android.com/tools\"\n" ) + " package=\"com.example.lib3\">\n" ) + "\n" ) + " <activity android:name=\"activityOne\" \n" ) + " android:theme=\"@oldtheme\"\n" ) + " android:exported=\"true\"/>\n" ) + "\n" ) + "</manifest>" ) ; com.android.manifmerger.XmlDocument highPriority = com.android.manifmerger.TestUtils.xmlDocumentFromString ( new com.android.manifmerger.TestUtils.TestSourceLocation ( getClass ( ) , "highPriority" ) , higherPriority ) ; com.android.manifmerger.XmlDocument lowPriority = com.android.manifmerger.TestUtils.xmlDocumentFromString ( new com.android.manifmerger.TestUtils.TestSourceLocation ( getClass ( ) , "lowPriority" ) , lowerPriority ) ; com.android.manifmerger.XmlDocument lowestPriority = com.android.manifmerger.TestUtils.xmlDocumentFromString ( new com.android.manifmerger.TestUtils.TestSourceLocation ( getClass ( ) , "lowestPriority" ) , evenLowerPriority ) ; com.android.manifmerger.MergingReport.Builder mergingReportBuilder = new com.android.manifmerger.MergingReport.Builder ( new com.android.utils.StdLogger ( StdLogger.Level.VERBOSE ) ) ; com.google.common.base.Optional < com.android.manifmerger.XmlDocument > result = highPriority.merge ( lowPriority , mergingReportBuilder ) ; assertTrue ( result.isPresent ( ) ) ; com.android.manifmerger.XmlDocument resultDocument = result.get ( ) ; result = resultDocument.merge ( lowestPriority , mergingReportBuilder ) ; assertTrue ( result.isPresent ( ) ) ; resultDocument = result.get ( ) ; com.google.common.base.Optional < com.android.manifmerger.XmlElement > activityOne = resultDocument.getRootNode ( ) . getNodeByTypeAndKey ( ManifestModel.NodeTypes.ACTIVITY , "com.example.lib3.activityOne" ) ; assertTrue ( activityOne.isPresent ( ) ) ; java.util.List < com.android.manifmerger.XmlAttribute > attributes = activityOne.get ( ) . getAttributes ( ) ; assertEquals ( 3 , attributes.size ( ) ) ; assertTrue ( activityOne.get ( ) . getAttribute ( com.android.manifmerger.XmlNode.fromXmlName ( "android:name" ) ) . isPresent ( ) ) ; assertTrue ( activityOne.get ( ) . getAttribute ( com.android.manifmerger.XmlNode.fromXmlName ( "android:screenOrientation" ) ) . isPresent ( ) ) ; assertTrue ( activityOne.get ( ) . getAttribute ( com.android.manifmerger.XmlNode.fromNSName ( SdkConstants.TOOLS_URI , "tools" , "remove" ) ) . isPresent ( ) ) ; com.android.manifmerger.Actions actions = mergingReportBuilder.getActionRecorder ( ) . build ( ) ; java.util.List < com.android.manifmerger.Actions.AttributeRecord > attributeRecords = actions.getAttributeRecords ( activityOne.get ( ) . getId ( ) , com.android.manifmerger.XmlNode.fromXmlName ( "android:theme" ) ) ; assertNotNull ( attributeRecords ) ; assertEquals ( 2 , attributeRecords.size ( ) ) ; com.android.manifmerger.Actions.AttributeRecord attributeRecord = attributeRecords.get ( 0 ) ; assertEquals ( Actions.ActionType.REJECTED , attributeRecord.getActionType ( ) ) ; assertEquals ( AttributeOperationType.REMOVE , attributeRecord.getOperationType ( ) ) ; assertEquals ( "XmlAttributeTest#lowPriority" , attributeRecord.getActionLocation ( ) . getSourceLocation ( ) . print ( true ) ) ; assertEquals ( 8 , attributeRecord.getActionLocation ( ) . getPosition ( ) . getLine ( ) ) ; attributeRecord = attributeRecords.get ( 1 ) ; assertEquals ( Actions.ActionType.REJECTED , attributeRecord.getActionType ( ) ) ; assertEquals ( AttributeOperationType.REMOVE , attributeRecord.getOperationType ( ) ) ; assertEquals ( "XmlAttributeTest#lowestPriority" , attributeRecord.getActionLocation ( ) . getSourceLocation ( ) . print ( true ) ) ; assertEquals ( 7 , attributeRecord.getActionLocation ( ) . getPosition ( ) . getLine ( ) ) ; }