这是一个示例,其中我有两个<mbean>
同名的部分,但这些部分中的属性不同,我想合并这两个<mbean>
部分,并且重复的属性必须替换为添加到<mbean>
部分底部的最新属性。
<mbean code="org.jboss.naming.JNDIBindingServiceMgr"
name="abc.myconfig.jndi:name=myconfigAppPartitionJNDI">
<attribute name="BindingsConfig" serialDataType="jbxb">
<jndi:bindings
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jndi="urn:jboss:jndi-binding-service:1.0"
xs:schemaLocation="urn:jboss:jndi-binding-service:1.0 resource:jndi-binding-service_1_0.xsd">
<jndi:binding
name="myabc/myconfig/myservice/myabcservice">
<jndi:value type="java.lang.String">
old-value
</jndi:value>
</jndi:binding>
<jndi:binding name="myabc/myconfig/myabcdefService/myabcdefServiceUrl">
<jndi:value type="java.lang.String">
@myabcdefService.myabcdefServiceUrl@
</jndi:value>
</jndi:binding>
</jndi:bindings>
</attribute>
</mbean>
<mbean code="org.jboss.naming.JNDIBindingServiceMgr"
name="abc.myconfig.jndi:name=myconfigAppPartitionJNDI">
<attribute name="BindingsConfig" serialDataType="jbxb">
<jndi:bindings
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jndi="urn:jboss:jndi-binding-service:1.0"
xs:schemaLocation="urn:jboss:jndi-binding-service:1.0 resource:jndi-binding-service_1_0.xsd">
<jndi:binding
name="myabc/myconfig/myservice/myabcservice">
<jndi:value type="java.lang.String">
new-value
</jndi:value>
</jndi:binding>
<jndi:binding name="myabc/myconfig/myabcdefService/myabcdefServiceUrl">
<jndi:value type="java.lang.String">
@myabcdefService.myabcdefServiceUrl@
</jndi:value>
</jndi:binding>
<jndi:binding name="myabc/myconfig/myabcdefService/myabcFileNet">
<jndi:value type="java.lang.String">
@myabcdefService.myabcFileNet@
</jndi:value>
</jndi:binding>
</jndi:bindings>
</attribute>
</mbean>
预期输出为:
<mbean code="org.jboss.naming.JNDIBindingServiceMgr"
name="abc.myconfig.jndi:name=myconfigAppPartitionJNDI">
<attribute name="BindingsConfig" serialDataType="jbxb">
<jndi:bindings
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jndi="urn:jboss:jndi-binding-service:1.0"
xs:schemaLocation="urn:jboss:jndi-binding-service:1.0 resource:jndi-binding-service_1_0.xsd">
<jndi:binding name="myabc/myconfig/myabcdefService/myabcdefServiceUrl">
<jndi:value type="java.lang.String">
@myabcdefService.myabcdefServiceUrl@
</jndi:value>
</jndi:binding>
<jndi:binding
name="myabc/myconfig/myservice/myabcservice">
<jndi:value type="java.lang.String">
new-value
</jndi:value>
</jndi:binding>
<jndi:binding name="myabc/myconfig/myabcdefService/myabcFileNet">
<jndi:value type="java.lang.String">
@myabcdefService.myabcFileNet@
</jndi:value>
</jndi:binding>
</jndi:bindings>
</attribute>
</mbean>