cleanseXML()   - trillium_quality - 17.1

Trillium Director SDK Reference Guide

Product type
Software
Portfolio
Verify
Product family
Trillium
Product
Trillium > Trillium Quality
Version
17.1
Language
English
Product name
Trillium Quality
Title
Trillium Director SDK Reference Guide
Topic type
Administration
Overview
How Do I
Configuration
Reference
Installation
First publish date
2008

The cleanseXML() method sends “dirty” data in an XML document to a cleansing server and receives back the “clean” or enriched data in an XML document. Data is cleansed according to the business rules made available to the target cleansing server during server startup.

Before calling this method, you must call the the attach() method to obtain a handle to the required cleansing server.

Note: Use of this method requires a special configuration file to define the format of the XML document. Use the TRILLCONFIG environment variable to point to this configuration file.

Syntax

public void cleanseXML(int handle,
                      java.lang.String rootTag,
                      java.lang.String inputXML,
                      java.lang.StringBuffer outputXML,
                      int retCode[]);

Parameters

Name

Type

Use

Length

Description

handle

int

In

––

Handle to a Director cleansing server.

rootTag

string[ ]

In

n*

XML root tag.

inputXML   

string[ ]

In

n*

XML string containing the data to be cleansed.

outputXML

string[ ]

Out

n*

StringBuffer where the cleansed XML will be returned.

retCode

int[ ]

Out

4

Error code that indicates status of method call.

n* indicates the maximum length and varies depending on the hardware and operating system on which the program runs.

Example

TrilTGenClient testClient = new TrilTGenClient();
int[] retCode= new int[1];             // Return code and handle
int handle = 0;
char systemID = 'G';                   // System and Server ID for
attach()
String serverName = "Cleanser";

// Root Tag of XML document
String rootTag = "CustomerData/PrimaryCustomer/Address";

// This is the input (dirty) XML document
String inputXML =
"<?xml version = '1.0' encoding = 'ISO-8859-1' standalone = 'no'?>" +
"<CustomerData>" +
    "<REQUESTTYPE>Cleanse</REQUESTTYPE>" +
    "<PrimaryCustomer>" +
        "<Name>John Smith</Name>" +
        "<Address>" +
            "<StreetLine1>11 falk</StreetLine1>" +
            "<StreetLine2 />" +
            "<City>pompton lakes</City>" +
            "<State>NJ</State>" +
            "<Country>US</Country>" +
            "<ZipCode></ZipCode>" +
      "</Address>" +
  "</PrimaryCustomer>" +
"</CustomerData> "

// Attach is required before cleanseXML()
handle = testClient.attach(systemID, serverName, retCode);
      if (retCode[0] == 0) {
        StringBuffer outputXML = new StringBuffer ("");
        testClient.cleanseXML(handle, rootTag, inputXML, outputXML, retCode);
          if (retCode[0] != 0) {
            System.out.println("cleanseXML method returned" + retCode[0]);
      } else {
      // Do something with cleansed data in outputXML
      }
      // Release cleansing server using release()
      testClient.release(handle, retCode);
}