我有 2 个 xml 文件,a.xml
并且是一些节点值已更改的修改版本。现在我想检查我的代码,只有特定的节点值可以更改,而不是所有节点。我怎样才能在java中进行这个检查?我从用户那里得到这个 xml,如果他更改了我不应该允许的其他节点,他只能更改特定节点。下面是 xml 你可以看到b.xml
b.xml
a.xml
<xt:path>HelloWorld/BusinessServices/Mytest</xt:path>
两者都发生了变化这是有效的情况,因为他也发生了变化
<xt:value xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema">40</xt:value>
从 30 到 40 这是无效的。
一个.xml
<?xml version="1.0" encoding="UTF-8"?>
<cus:Customizations xmlns:cus="http://www.bea.com/wli/config/customizations" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xt="http://www.bea.com/wli/config/xmltypes">
<cus:customization xsi:type="cus:EnvValueCustomizationType">
<cus:description/>
<cus:envValueAssignments>
<xt:envValueType>Service URI Weight</xt:envValueType>
<xt:location>0</xt:location>
<xt:owner>
<xt:type>BusinessService</xt:type>
<xt:path>HelloWorld/BusinessServices/Test123</xt:path>
</xt:owner>
<xt:value xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema">0</xt:value>
</cus:envValueAssignments>
<cus:envValueAssignments>
<xt:envValueType>Service URI</xt:envValueType>
<xt:location>0</xt:location>
<xt:owner>
<xt:type>BusinessService</xt:type>
<xt:path>HelloWorld/BusinessServices/Test123</xt:path>
</xt:owner>
<xt:value xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema">jejb:oracle:test</xt:value>
</cus:envValueAssignments>
<cus:envValueAssignments>
<xt:envValueType>Service URI Table</xt:envValueType>
<xt:location xsi:nil="true"/>
<xt:owner>
<xt:type>BusinessService</xt:type>
<xt:path>HelloWorld/BusinessServices/Test123</xt:path>
</xt:owner>
<xt:value>
<tableElement xmlns="http://www.bea.com/wli/sb/transports">
<URI>jejb:oracle:test</URI>
<weight>0</weight>
</tableElement>
</xt:value>
</cus:envValueAssignments>
<cus:envValueAssignments>
<xt:envValueType>Service Retry Count</xt:envValueType>
<xt:location xsi:nil="true"/>
<xt:owner>
<xt:type>BusinessService</xt:type>
<xt:path>HelloWorld/BusinessServices/Test123</xt:path>
</xt:owner>
<xt:value xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema">0</xt:value>
</cus:envValueAssignments>
<cus:envValueAssignments>
<xt:envValueType>Service Retry Iteration Interval</xt:envValueType>
<xt:location xsi:nil="true"/>
<xt:owner>
<xt:type>BusinessService</xt:type>
<xt:path>HelloWorld/BusinessServices/Test123</xt:path>
</xt:owner>
<xt:value xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema">30</xt:value>
</cus:envValueAssignments>
</cus:customization>
<cus:customization xsi:type="cus:FindAndReplaceCustomizationType">
<cus:description/>
<cus:query>
<xt:resourceTypes>BusinessService</xt:resourceTypes>
<xt:envValueTypes>Service Retry Iteration Interval</xt:envValueTypes>
<xt:envValueTypes>Service URI Weight</xt:envValueTypes>
<xt:envValueTypes>Service Retry Count</xt:envValueTypes>
<xt:envValueTypes>Service URI</xt:envValueTypes>
<xt:refsToSearch xsi:type="xt:ResourceRefType">
<xt:type>BusinessService</xt:type>
<xt:path>HelloWorld/BusinessServices/Test123</xt:path>
</xt:refsToSearch>
<xt:includeOnlyModifiedResources>false</xt:includeOnlyModifiedResources>
<xt:searchString>Search String</xt:searchString>
<xt:isCompleteMatch>false</xt:isCompleteMatch>
</cus:query>
<cus:replacement>Replacement String</cus:replacement>
</cus:customization>
<cus:customization xsi:type="cus:ReferenceCustomizationType">
<cus:description/>
<cus:refsToBeConsidered xsi:type="xt:ResourceRefType">
<xt:type>BusinessService</xt:type>
<xt:path>HelloWorld/BusinessServices/Test123</xt:path>
</cus:refsToBeConsidered>
<cus:externalReferenceMap>
<xt:oldRef>
<xt:type>ForeignJNDIProvider</xt:type>
<xt:path>System/JNDI Providers/oracle</xt:path>
</xt:oldRef>
<xt:newRef>
<xt:type>ForeignJNDIProvider</xt:type>
<xt:path>System/JNDI Providers/oracle</xt:path>
</xt:newRef>
</cus:externalReferenceMap>
<cus:externalReferenceMap>
<xt:oldRef>
<xt:type>Archive</xt:type>
<xt:path>dev/HelloOsbEjbClient</xt:path>
</xt:oldRef>
<xt:newRef>
<xt:type>Archive</xt:type>
<xt:path>dev/HelloOsbEjbClient</xt:path>
</xt:newRef>
</cus:externalReferenceMap>
</cus:customization>
</cus:Customizations>
b.xml
<?xml version="1.0" encoding="UTF-8"?>
<cus:Customizations xmlns:cus="http://www.bea.com/wli/config/customizations" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xt="http://www.bea.com/wli/config/xmltypes">
<cus:customization xsi:type="cus:EnvValueCustomizationType">
<cus:description/>
<cus:envValueAssignments>
<xt:envValueType>Service URI Weight</xt:envValueType>
<xt:location>0</xt:location>
<xt:owner>
<xt:type>BusinessService</xt:type>
<xt:path>HelloWorld/BusinessServices/Test123</xt:path>
</xt:owner>
<xt:value xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema">0</xt:value>
</cus:envValueAssignments>
<cus:envValueAssignments>
<xt:envValueType>Service URI</xt:envValueType>
<xt:location>0</xt:location>
<xt:owner>
<xt:type>BusinessService</xt:type>
<xt:path>HelloWorld/BusinessServices/Test123</xt:path>
</xt:owner>
<xt:value xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema">jejb:oracle:test</xt:value>
</cus:envValueAssignments>
<cus:envValueAssignments>
<xt:envValueType>Service URI Table</xt:envValueType>
<xt:location xsi:nil="true"/>
<xt:owner>
<xt:type>BusinessService</xt:type>
<xt:path>HelloWorld/BusinessServices/Test123</xt:path>
</xt:owner>
<xt:value>
<tableElement xmlns="http://www.bea.com/wli/sb/transports">
<URI>jejb:oracle:test</URI>
<weight>0</weight>
</tableElement>
</xt:value>
</cus:envValueAssignments>
<cus:envValueAssignments>
<xt:envValueType>Service Retry Count</xt:envValueType>
<xt:location xsi:nil="true"/>
<xt:owner>
<xt:type>BusinessService</xt:type>
<xt:path>HelloWorld/BusinessServices/Test123</xt:path>
</xt:owner>
<xt:value xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema">0</xt:value>
</cus:envValueAssignments>
<cus:envValueAssignments>
<xt:envValueType>Service Retry Iteration Interval</xt:envValueType>
<xt:location xsi:nil="true"/>
<xt:owner>
<xt:type>BusinessService</xt:type>
<xt:path>HelloWorld/BusinessServices/Mytest</xt:path>
</xt:owner>
<xt:value xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema">40</xt:value>
</cus:envValueAssignments>
</cus:customization>
<cus:customization xsi:type="cus:FindAndReplaceCustomizationType">
<cus:description/>
<cus:query>
<xt:resourceTypes>BusinessService</xt:resourceTypes>
<xt:envValueTypes>Service Retry Iteration Interval</xt:envValueTypes>
<xt:envValueTypes>Service URI Weight</xt:envValueTypes>
<xt:envValueTypes>Service Retry Count</xt:envValueTypes>
<xt:envValueTypes>Service URI</xt:envValueTypes>
<xt:refsToSearch xsi:type="xt:ResourceRefType">
<xt:type>BusinessService</xt:type>
<xt:path>HelloWorld/BusinessServices/MyTest</xt:path>
</xt:refsToSearch>
<xt:includeOnlyModifiedResources>false</xt:includeOnlyModifiedResources>
<xt:searchString>Search String</xt:searchString>
<xt:isCompleteMatch>false</xt:isCompleteMatch>
</cus:query>
<cus:replacement>Replacement String</cus:replacement>
</cus:customization>
<cus:customization xsi:type="cus:ReferenceCustomizationType">
<cus:description/>
<cus:refsToBeConsidered xsi:type="xt:ResourceRefType">
<xt:type>BusinessService</xt:type>
<xt:path>HelloWorld/BusinessServices/Test123</xt:path>
</cus:refsToBeConsidered>
<cus:externalReferenceMap>
<xt:oldRef>
<xt:type>ForeignJNDIProvider</xt:type>
<xt:path>System/JNDI Providers/oracle</xt:path>
</xt:oldRef>
<xt:newRef>
<xt:type>ForeignJNDIProvider</xt:type>
<xt:path>System/JNDI Providers/oracle</xt:path>
</xt:newRef>
</cus:externalReferenceMap>
<cus:externalReferenceMap>
<xt:oldRef>
<xt:type>Archive</xt:type>
<xt:path>dev/HelloOsbEjbClient</xt:path>
</xt:oldRef>
<xt:newRef>
<xt:type>Archive</xt:type>
<xt:path>dev/HelloOsbEjbClient</xt:path>
</xt:newRef>
</cus:externalReferenceMap>
</cus:customization>
</cus:Customizations>