我试图在现有 XML 文件的某个 xpath 下添加一个内容块。我不熟悉使用 Perl 进行这种 XML 解析。但我应该使用这个XML::Twig。
输入 :
<model name="MDL_#USER#" oid="#LOOP#">
<appli name="ERETAIL" oid="2">
<schema desc="Parameters schema" enab="YES" name="Parameters" oid="1" prio="1">
<bean enab="YES" labl="Parameters" name="ERETAILPARA" oid="3" vers="1.0" xpos="0" ypos="0">
<para>
<root>
<row desc="password encryption mode" name="OISENCRYPT" value="BASE64"/>
</root>
</para>
</bean>
</schema>
</appli>
输出:
<model name="MDL_#USER#" oid="#LOOP#">
<appli name="ERETAIL" oid="2">
<schema desc="Parameters schema" enab="YES" name="Parameters" oid="1" prio="1">
<bean enab="YES" labl="Parameters" name="ERETAILPARA" oid="3" vers="1.0" xpos="0" ypos="0">
<para>
<root>
<row desc="password encryption mode" name="OISENCRYPT" value="BASE64"/>
<row name="INTERNAL" desc="" value="">
<row name="PATH" desc="Path" value="#PATH#" />
<row name="EXT" desc="Adresse" value="#GAIAIP#" />
</row>
</root>
</para>
</bean>
</schema>
</appli>