Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

<config-file> should have text as innerxml rather than actual xml #4

Open
Zammy opened this Issue · 2 comments

2 participants

@Zammy

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"
                  android:label="@string/app_name">
            <intent-filter>
            </intent-filter>
        </activity> ]]>
    </config-file>
@alunny
Owner

How are the inner tags being transformed by the .NET parser?

@Zammy

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.