我有這個 XML 檔案:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="dialect">1</property>
<property name="connection.provider">1</property>
<property name="connection.driver_class">2</property>
<property name="connection.db">3</property>
</session-factory>
</hibernate-configuration>
并且需要使用 Bash 將“property name=connection.db”更改為 4。
已經試過了
xmlstarlet ed -u "/hibernate-configuration/session-factory/property[@name='connection.db']" -v '4' test1.config
和
xmlstarlet ed -u "//session-factory/property[@name='db']" -v '4' test1.config
但兩者都不起作用。任何幫助,將不勝感激。
uj5u.com熱心網友回復:
您需要考慮命名空間。嘗試
xmlstarlet ed -L -N x="urn:nhibernate-configuration-2.2" -u "//x:session-factory//x:property[@name='connection.db']" -v "4" test1.config
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/520099.html
