Source:
public void testMultipleCustomElements ( ) throws java.io.IOException , javax.xml.parsers.ParserConfigurationException , org.xml.sax.SAXException { java.lang.String main = "" + ( ( ( ( ( ( "<manifest\n" + " xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" ) + " package=\"com.example.lib3\">\n" ) + "\n" ) + " <application android:label=\"@string/lib_name\" />\n" ) + "\n" ) + "</manifest>" ) ; java.lang.String library = "" + ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( "<manifest\n" + " xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" ) + " xmlns:acme=\"http://acme.org/schemas\"\n" ) + " xmlns:acme2=\"http://acme2.org/schemas\"\n" ) + " package=\"com.example.lib3\">\n" ) + "\n" ) + " <activity android:name=\"activityOne\" />\n" ) + " <acme:another acme:name=\"anotherOne\" \n" ) + " acme:ns-attribute=\"ns-value\" >\n" ) + " <acme:some-child acme:child-attr=\"foo\" /> \n" ) + " </acme:another>\n" ) + " <acme:another2 acme:name=\"anotherOne\" \n" ) + " acme:ns-attribute=\"ns-value\" >\n" ) + " <acme:some-child acme:child-attr=\"foo\" /> \n" ) + " </acme:another2>\n" ) + " <acme2:another acme2:name=\"anotherOne\" \n" ) + " acme2:ns-attribute=\"ns-value\" >\n" ) + " <acme2:some-child acme2:child-attr=\"foo\" /> \n" ) + " </acme2:another>\n" ) + " <acme2:another2 acme2:name=\"anotherOne\" \n" ) + " acme2:ns-attribute=\"ns-value\" >\n" ) + " <acme2:some-child acme2:child-attr=\"foo\" /> \n" ) + " </acme2:another2>\n" ) + "\n" ) + "</manifest>" ) ; com.android.manifmerger.XmlDocument mainDocument = com.android.manifmerger.TestUtils.xmlDocumentFromString ( new com.android.manifmerger.TestUtils.TestSourceLocation ( getClass ( ) , "main" ) , main ) ; com.android.manifmerger.XmlDocument libraryDocument = com.android.manifmerger.TestUtils.xmlDocumentFromString ( new com.android.manifmerger.TestUtils.TestSourceLocation ( getClass ( ) , "library" ) , library ) ; com.android.manifmerger.MergingReport.Builder mergingReportBuilder = new com.android.manifmerger.MergingReport.Builder ( mLogger ) ; com.google.common.base.Optional < com.android.manifmerger.XmlDocument > mergedDocument = mainDocument.merge ( libraryDocument , mergingReportBuilder ) ; assertTrue ( mergedDocument.isPresent ( ) ) ; com.android.manifmerger.XmlElement rootNode = mergedDocument.get ( ) . getRootNode ( ) ; assertTrue ( rootNode.getNodeByTypeAndKey ( ManifestModel.NodeTypes.APPLICATION , null ) . isPresent ( ) ) ; com.google.common.base.Optional < com.android.manifmerger.XmlElement > activityOne = rootNode.getNodeByTypeAndKey ( ManifestModel.NodeTypes.ACTIVITY , "com.example.lib3.activityOne" ) ; assertTrue ( activityOne.isPresent ( ) ) ; org.w3c.dom.Element validated = com.android.manifmerger.XmlDocumentTest.validate ( mergedDocument.get ( ) . prettyPrint ( ) ) ; org.w3c.dom.Node namedItem = validated.getAttributes ( ) . getNamedItem ( "xmlns:acme" ) ; assertEquals ( namedItem.getNodeValue ( ) , "http://acme.org/schemas" ) ; namedItem = validated.getAttributes ( ) . getNamedItem ( "xmlns:acme2" ) ; assertEquals ( namedItem.getNodeValue ( ) , "http://acme2.org/schemas" ) ; int elementsNumber = 0 ; for ( int i = 0 ; i < ( validated.getChildNodes ( ) . getLength ( ) ) ; i ++ ) { org.w3c.dom.Node item = validated.getChildNodes ( ) . item ( i ) ; if ( item instanceof org.w3c.dom.Element ) { elementsNumber ++ ; } } assertEquals ( 6 , elementsNumber ) ; }

Target:
public void testMultipleCustomElements ( ) throws java.io.IOException , javax.xml.parsers.ParserConfigurationException , org.xml.sax.SAXException { java.lang.String main = "" + ( ( ( ( ( ( "<manifest\n" + " xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" ) + " package=\"com.example.lib3\">\n" ) + "\n" ) + " <application android:label=\"@string/lib_name\" />\n" ) + "\n" ) + "</manifest>" ) ; java.lang.String library = "" + ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( "<manifest\n" + " xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" ) + " xmlns:acme=\"http://acme.org/schemas\"\n" ) + " xmlns:acme2=\"http://acme2.org/schemas\"\n" ) + " package=\"com.example.lib3\">\n" ) + "\n" ) + " <activity android:name=\"activityOne\" />\n" ) + " <acme:another acme:name=\"anotherOne\" \n" ) + " acme:ns-attribute=\"ns-value\" >\n" ) + " <acme:some-child acme:child-attr=\"foo\" /> \n" ) + " </acme:another>\n" ) + " <acme:another2 acme:name=\"anotherOne\" \n" ) + " acme:ns-attribute=\"ns-value\" >\n" ) + " <acme:some-child acme:child-attr=\"foo\" /> \n" ) + " </acme:another2>\n" ) + " <acme2:another acme2:name=\"anotherOne\" \n" ) + " acme2:ns-attribute=\"ns-value\" >\n" ) + " <acme2:some-child acme2:child-attr=\"foo\" /> \n" ) + " </acme2:another>\n" ) + " <acme2:another2 acme2:name=\"anotherOne\" \n" ) + " acme2:ns-attribute=\"ns-value\" >\n" ) + " <acme2:some-child acme2:child-attr=\"foo\" /> \n" ) + " </acme2:another2>\n" ) + "\n" ) + "</manifest>" ) ; com.android.manifmerger.XmlDocument mainDocument = com.android.manifmerger.TestUtils.xmlDocumentFromString ( new com.android.manifmerger.TestUtils.TestSourceLocation ( getClass ( ) , "main" ) , main ) ; com.android.manifmerger.XmlDocument libraryDocument = com.android.manifmerger.TestUtils.xmlLibraryFromString ( new com.android.manifmerger.TestUtils.TestSourceLocation ( getClass ( ) , "library" ) , library ) ; com.android.manifmerger.MergingReport.Builder mergingReportBuilder = new com.android.manifmerger.MergingReport.Builder ( mLogger ) ; com.google.common.base.Optional < com.android.manifmerger.XmlDocument > mergedDocument = mainDocument.merge ( libraryDocument , mergingReportBuilder ) ; assertTrue ( mergedDocument.isPresent ( ) ) ; com.android.manifmerger.XmlElement rootNode = mergedDocument.get ( ) . getRootNode ( ) ; assertTrue ( rootNode.getNodeByTypeAndKey ( ManifestModel.NodeTypes.APPLICATION , null ) . isPresent ( ) ) ; com.google.common.base.Optional < com.android.manifmerger.XmlElement > activityOne = rootNode.getNodeByTypeAndKey ( ManifestModel.NodeTypes.ACTIVITY , "com.example.lib3.activityOne" ) ; assertTrue ( activityOne.isPresent ( ) ) ; org.w3c.dom.Element validated = com.android.manifmerger.XmlDocumentTest.validate ( mergedDocument.get ( ) . prettyPrint ( ) ) ; org.w3c.dom.Node namedItem = validated.getAttributes ( ) . getNamedItem ( "xmlns:acme" ) ; assertEquals ( namedItem.getNodeValue ( ) , "http://acme.org/schemas" ) ; namedItem = validated.getAttributes ( ) . getNamedItem ( "xmlns:acme2" ) ; assertEquals ( namedItem.getNodeValue ( ) , "http://acme2.org/schemas" ) ; int elementsNumber = 0 ; for ( int i = 0 ; i < ( validated.getChildNodes ( ) . getLength ( ) ) ; i ++ ) { org.w3c.dom.Node item = validated.getChildNodes ( ) . item ( i ) ; if ( item instanceof org.w3c.dom.Element ) { elementsNumber ++ ; } } assertEquals ( 6 , elementsNumber ) ; }