1
我有下面的XML:如何使用BW映射器將另一個XML中的值替換爲一個XML?
usa11.xml:
<?xml version="1.0" encoding="UTF-8"?>
<country xmlns="http://www.tibco.com/xmlns/ApplicationManagement" >
<state name="CA">
<city>
<street>El Comino Ave.</street>
<library>library 11111.</library>
</city>
<city>
<street>DeAnza Ave.</street>
<library>library 22222.</library>
</city>
<city>
<street>shoreline Ave.</street>
<library>library 33333.</library>
</city>
</state>
</country>
和另一個XML: usa22.xml:
<?xml version="1.0" encoding="UTF-8"?>
<country xmlns="http://www.tibco.com/xmlns/ApplicationManagement" >
<state name="CA">
<city>
<street>El Comino Ave.</street>
<library>library AAAAA.</library>
</city>
<city>
<street>DeAnza Ave.</street>
<library>library BBBBB.</library>
</city>
</state>
</country>
話,我希望用Tibco的BW映射器使用usa22。 xml的元素只有在它們的街道名稱相同時纔會替換usa11.xml的元素:然後按如下所示輸出usa33.xml out.xml:
<?xml version="1.0" encoding="UTF-8"?>
<country xmlns="http://www.tibco.com/xmlns/ApplicationManagement">
<state name="CA">
<city>
<street>El Comino Ave.</street>
<library>library AAAAA.</library>
</city>
<city>
<street>DeAnza Ave.</street>
<library>library BBBBB.</library>
</city>
<city>
<street>shoreline Ave.</street>
<library>library 33333.</library>
</city>
</state>
</country>
請拋出一些燈如何使用Tibco BW映射器來執行此值替換?
架構如下:
usa.xsd:
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.tibco.com/xmlns/ApplicationManagement" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="country">
<xs:complexType>
<xs:sequence>
<xs:element name="state">
<xs:complexType>
<xs:sequence>
<xs:element name="city" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="street"/>
<xs:element type="xs:string" name="library"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:string" name="name"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
非常感謝!
TIBCO BW Mapper只是一個圖形化的XSLT。如果您選擇映射器的根節點並將其複製並粘貼到文本文檔中,則可以像平常一樣退出xslt,然後將其複製並返回。 –