A sample implementation, UseXMLBuilder.java, is included in the RepConnector installation <sample/client >directory. When you compile and run the sample, include the repraconn.jar file in your CLASSPATH. For example, enter:
java-classpath.:$REPRA_HOME/lib/repraconn.jar:$REPR_HOME/lib/ dom4j-full.jar UseXMLBuildertext.xml
The result looks like the following:
Output of multiple update db events in a single transaction: <?xml version="1.0" encoding="UTF-8"?>
dbStream xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file://dbeventstream.xsd" environment="pubs2"> <tran eventId="00001001"> <update schema="authors"> <values> <cell name="au_id" type="CHAR">0001</cell> <cell name="address" type="VARCHAR">1 Sybase</cell> <values> <oldValues> <cell name="au_id" type="CHAR" operator="=">0002</cell> <cell name="address" type="VARCHAR" condition="AND" operator="=">3 Sybase</cell> </oldValues> </update> <delete schema="authors"> <values> <cell name="au_id" type="CHAR">0001</cell> <cell name="address" type="VARCHAR">1 Sybase</cell> </values </oldValues> <cell name="au_id" type="CHAR" operator="=">0002</cell> <cell name="address" type="VARCHAR" condition="AND" operator="=">3 Sybase</cell> </oldValues> </delete> </update> </tran> </dbStream> Output of multiple dbevents in a transaction: <?xml version="1.0" encoding="UTF-8"?> dbStream xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file://dbeventstream.xsd" environment="pubs3"> <tran eventId="00001002"> <update schema="stores"> <values> <cell name="au_id" type="CHAR">0002</cell> <cell name="address" type="VARCHAR">1 Sybase</cell> <values> </oldValues> </update> <exec schema="storesProcedure1"> <inValues> <cell name="au_id" type="CHAR">0002</cell> </inValues> <outValues> <cell name="au_id" type="CHAR">0002</cell> </outValues </exec> </dbEvent> </dbStream> Output of a stored procedure: <?xml version="1.0" encoding="UTF-8"?> dbStream xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file://dbeventstream.xsd" environment="pubs3"> <dbEventId="00001003"> <update schema="storesProcedure1"> <inValues> <cell name="au_id" type="CHAR">0002</cell> </inValues> <outValues> <cell name="au_id" type="CHAR">0002</cell> </outValues </exec> </dbEvent> </dbStream>