Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Shell脚本-如何将新的XML元素添加并保存到XML文件中?_Xml_Shell_Netbeans - Fatal编程技术网

Shell脚本-如何将新的XML元素添加并保存到XML文件中?

Shell脚本-如何将新的XML元素添加并保存到XML文件中?,xml,shell,netbeans,Xml,Shell,Netbeans,我正在执行一项与操作Netbeans项目配置文件相关的任务,这要求我向XML文件添加一个新的XML元素。 例如,假设我在/home/myusername/Desktop/testxml.XML中有这个XML文件,其内容是: <project name="example" default="default" basedir="."> <description>Description 1: The first description</description&g

我正在执行一项与操作Netbeans项目配置文件相关的任务,这要求我向XML文件添加一个新的XML元素。
例如,假设我在
/home/myusername/Desktop/testxml.XML
中有这个XML文件,其内容是:

<project name="example" default="default" basedir=".">
    <description>Description 1: The first description</description>
</project>
我该怎么做呢?

试试看,或者
<description>Description 2: The second description</description>
<project name="example" default="default" basedir=".">
    <description>Description 1: The first description</description>
    <description>Description 2: The second description</description>
</project>