XML如下 如何以最快的速度查找到
android:name="android.intent.category.LAUNCHER"
的这个节点!并删除掉!
<?xml version="1.0" encoding="UTF-8"?>
<manifest android:versionCode="1" android:versionName="1.0.0" package="com.android.test1"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <application android:label="@string/app_name" android:icon="@drawable/logo" android:name="TestApplication" android:debuggable="false" android:taskAffinity="com.android.test1">
        <activity android:theme="@style/ContentOverlay" android:name="SwitchUser" android:exported="true" android:configChanges="keyboardHidden|orientation" android:windowSoftInputMode="stateAlwaysHidden">
            <intent-filter>
                <action android:name="com.android.test1.intent.action.USER_SWITCH" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity android:theme="@style/ContentOverlay" android:name="UserTest1AttentionFansList" android:configChanges="keyboardHidden|orientation">
            <intent-filter>
                <action android:name="com.android.test1.intent.action.BLOG_DELETE" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" android:name="SplashActivity" android:alwaysRetainTaskState="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" /><!--查找此节点-->
            </intent-filter>
        </activity>    </application>
</manifest>

解决方案 »

  1.   

    XmlDocument doc = new XmlDocument();
                    doc.Load(path);
                    XmlNode xn = doc.SelectSingleNode(node);
    有个RemoveChild  你自己去整吧
      

  2.   

    用xpath
    http://wenku.baidu.com/view/a7f8d9f9770bf78a652954db.html
      

  3.   

    完整解决:  XmlDocument doc = new XmlDocument();
      doc.Load(@"C:\test.xml");
      XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
      nsmgr.AddNamespace("android", "http://schemas.android.com/apk/res/android");  XmlNodeList nodelist = doc.SelectNodes("//category[@android:name='android.intent.category.DEFAULT']", nsmgr);
      foreach(XmlNode node in nodelist)
      {
         XmlNode parent=node.ParentNode;
         parent.RemoveChild(node);
      }
      
      doc.Save(@"C:\test.xml"); 
      

  4.   

    喔,看成有多个节点了,原来只有一个节点,那就更简单,改成:
      XmlDocument doc = new XmlDocument();
      doc.Load(@"C:\test.xml");
      XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
      nsmgr.AddNamespace("android", "http://schemas.android.com/apk/res/android");  XmlNode node = doc.SelectSingleNode("//category[@android:name='android.intent.category.LAUNCHER']", nsmgr);
      XmlNode parent = node.ParentNode;
      parent.RemoveChild(node);
      doc.Save(@"C:\test.xml"); 关键是那个命名空间!