Using RaXMLBuilder in your code

To use this utility in your own code, follow these steps.

StepsUsing the RaXML utility in your code

  1. Import the essential modules:

    import org.dom4j.Element;
    import com.sybase.connector.repra.util.*;
    
  2. Create an instance of RaXMLBuilder:

    RaXMLBuilder raXML = new RaXMLBuilder();
    
  3. Get the event body, which requires three parameters:

  4. Add an operation, which requires two parameters:

    For example:

    Element oper1=foo.addOperation("update","authors"):
    
  5. Add data to the operation, which requires four parameters:

    For example:

    foo.addValue(operl,"au_id","	CHAR","0001");
    foo.addValue(oper1,"au_num","INT","1");
    

    The field types, as SQL datatypes, are: TEXT, DATETIME, SMALLDATETIME, MONEY, SMALLMONEY, NUMERIC, DECIMAL, VARCHAR, CHAR, DATE, TIME BINARY, IMAGE, VARBINARY TINYINT, SMALLINT, INT REAL FLOAT BIT UNICHAR, UNIVARCHAR UNITEXT BIGINT, USMALLINT, UINT, UBIGINT

  6. Add a where clause to the operation, which requires six parameters:

    For example:

                    foo.addWhere(oper1,"au_id","CHAR","0002","AND","=");
    
  7. Create an XML file:

    foo.write(fileName);
    
  8. Get the String value of the event from the current XML document:

    String dataStr=foo.xmlDocString();
    

    Your application must send the dataStr object to the RepConnector connection.