2 Better ways to Comment in XML code, both Line and Block

How to add Comment in XML language?

Adding a comment in XML programming language is pretty verbose when compared with other popular programming languages like Python and Java. However, its same as your comment in HTML and Javascript programming language.

<!– YOUR COMMENT IN XML GOES HERE –>

2 Better ways to Comment in XML code, both Line and Block

For better understanding, you can see the XML code below and see how one can comments in XML programming language!

<?xml version="1.0" encoding="utf-8"?>
<!-- This file was automatically generated by the Google Play Games plugin for Unity
Do not edit. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.example.games.mainlibproj"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16" />

<application>

<!-- Required for Nearby Connections API -->
<meta-data android:name="com.google.android.gms.nearby.connection.SERVICE_ID"
android:value="" />

<!-- The space in these forces it to be interpreted as a string vs. int -->
<meta-data android:name="com.google.android.gms.games.APP_ID"
android:value="\ 693706626428" />

<!-- Keep track of which plugin is being used -->
<meta-data android:name="com.google.android.gms.games.unityVersion"
android:value="\ 0.9.42" />

<!-- Here is a comments in XML language

in more than one line

and that's how you rock! -->

<activity android:name="com.google.games.bridge.NativeBridgeActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
</application>
</manifest>

and now that you know how to add comments in XML programming language, you can explore some more programming languages like Python here.

Like what you're reading? Subscribe to our Weekly Tech Newsletter!

* indicates required