I believe <config-file> should have their contents as literal strings. Technically we do not care what kind of xml is inside. We just want to insert this text at the end of XPath element inner xml. Actually parsing <config-file> is pretty difficult (at least in .NET). When you read it namespaces are added to xml inside <config-file> which is not what we want but what should happened to have self contained xml.
Here is how I changed the plugin.xml <config-file> for AndroidManifest of Child Browser.
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<![CDATA[ <activity android:name="com.phonegap.plugins.childBrowser.ChildBrowser"
How are the inner tags being transformed by the .NET parser?
It takes the phonegap namespace and put it in as global namespace. That is by some XML language standard I assume.
Because <intent-filter> and <activity> are not in any namespace, the parser takes the global one, which is phonegap and puts it in every xml tag. This way you have self-contained XML with the namespace. It is syntatically correct with your XML but it is wrong for our case because xml is actually in android namespace. When you put the <activity> inside <config-file> without specifing which namespace it is, it becomes part of the global one, which is phonegap.
We should either use literal string for the content, as we do not care for the XML inside but for its content, or specificy the namespace for all level 1 tags inside <config-file> aka <android:activity />. I am not 100% the second solution will work but the first one works perfectly.
/offtopic: Why not JSON? What does xml give us ?