Hi Nigel…Please find the complete program:
import com.docuverse.dom.;
import com.softwareag.tamino.API.dom2.;
import java.io.;
import java.util.;
import java.text.;
import java.lang.reflect.;
/*
* Title:XMLRep_QI_Insert
* Description: Insert application for Query Interface module of XML Repository system,
* @author : Alok Sharma CS99757
* @version 1.0
/
public class XMLRep_QI_Insert {
public static void XMLRep_QI_insertRecord(Vector XMLRep_QI_input, String var_QI_Insert_collection, String var_QI_Insert_doctype, String var_QI_Insert_DBName ) throws Exception
{
try{
//Variable Declaratiion
String var_QI_Insert_firstname = null;
String var_QI_Insert_surname = null;
String var_QI_Insert_firstname_doc= null;
String var_QI_Insert_surname_doc = null;
String var_QI_Insert_sex = null;
String var_QI_Insert_remarks = null;
String var_QI_Insert_born = null;
String var_QI_Insert_street = null;
String var_QI_Insert_housenumber = null;
String var_QI_Insert_city = null;
String var_QI_Insert_postcode = null;
String var_QI_Insert_company = null;
String var_QI_Insert_policynumber = null;
String var_QI_Insert_date = null;
String var_QI_Insert_symptoms = null;
String var_QI_Insert_diagnosis = null;
String var_QI_Insert_type = null;
String var_QI_Insert_dosage = null;
String var_QI_Insert_title = null;
//Get the values from the input vector and put it in respective variables
var_QI_Insert_firstname = (String) XMLRep_QI_input.get(0);
var_QI_Insert_surname = (String) XMLRep_QI_input.get(1);
var_QI_Insert_sex = (String) XMLRep_QI_input.get(2);
var_QI_Insert_remarks = (String) XMLRep_QI_input.get(3);
var_QI_Insert_born = (String) XMLRep_QI_input.get(4);
var_QI_Insert_street = (String) XMLRep_QI_input.get(5);
var_QI_Insert_housenumber = (String) XMLRep_QI_input.get(6);
var_QI_Insert_city = (String) XMLRep_QI_input.get(7);
var_QI_Insert_postcode = (String) XMLRep_QI_input.get(8);
var_QI_Insert_company = (String) XMLRep_QI_input.get(9);
var_QI_Insert_policynumber = (String) XMLRep_QI_input.get(10);
var_QI_Insert_date = (String) XMLRep_QI_input.get(11);
var_QI_Insert_symptoms = (String) XMLRep_QI_input.get(12);
var_QI_Insert_diagnosis = (String) XMLRep_QI_input.get(13);
var_QI_Insert_firstname_doc = (String) XMLRep_QI_input.get(14);
var_QI_Insert_surname_doc = (String) XMLRep_QI_input.get(15);
var_QI_Insert_type = (String) XMLRep_QI_input.get(16);
var_QI_Insert_dosage = (String) XMLRep_QI_input.get(17);
var_QI_Insert_title = “Dr.”;
// TaminoClient tamino=new TaminoClient( “http://localhost/tamino/Sample” );
TaminoClient tamino=new TaminoClient(var_QI_Insert_DBName);
tamino.startSession();
// Create the root element “patient”
// All sub elements will get created and added to the root element.
BasicDocument doc=new BasicDocument();
BasicElement patient = new BasicElement(doc,“patient”);
BasicElement name = new BasicElement(doc,“name”);
BasicElement var_QI_Insert_tempElement = new BasicElement(doc,“surname”);
var_QI_Insert_tempElement.appendChild(new BasicText(doc,var_QI_Insert_surname));
name.appendChild(var_QI_Insert_tempElement);
var_QI_Insert_tempElement = new BasicElement(doc,“firstname”);
var_QI_Insert_tempElement.appendChild(new BasicText(doc,var_QI_Insert_firstname));
name.appendChild(var_QI_Insert_tempElement);
patient.appendChild(name);
var_QI_Insert_tempElement = new BasicElement(doc,"");
var_QI_Insert_tempElement.appendChild(new BasicText(doc,var_QI_Insert_sex));
patient.appendChild(var_QI_Insert_tempElement);
var_QI_Insert_tempElement = new BasicElement(doc,“born”);
var_QI_Insert_tempElement.appendChild(new BasicText(doc,var_QI_Insert_born));
patient.appendChild(var_QI_Insert_tempElement);
BasicElement address = new BasicElement(doc,“address”);
var_QI_Insert_tempElement = new BasicElement(doc,“street”);
var_QI_Insert_tempElement.appendChild(new BasicText(doc,var_QI_Insert_street));
address.appendChild(var_QI_Insert_tempElement);
var_QI_Insert_tempElement = new BasicElement(doc,“housenumber”);
var_QI_Insert_tempElement.appendChild(new BasicText(doc,var_QI_Insert_housenumber));
address.appendChild(var_QI_Insert_tempElement);
var_QI_Insert_tempElement = new BasicElement(doc,“city”);
var_QI_Insert_tempElement.appendChild(new BasicText(doc,var_QI_Insert_city));
address.appendChild(var_QI_Insert_tempElement);
var_QI_Insert_tempElement = new BasicElement(doc,“postcode”);
var_QI_Insert_tempElement.appendChild(new BasicText(doc,var_QI_Insert_postcode));
address.appendChild(var_QI_Insert_tempElement);
patient.appendChild(address);
BasicElement insurance = new BasicElement(doc,“insurance”);
var_QI_Insert_tempElement = new BasicElement(doc,“company”);
var_QI_Insert_tempElement.appendChild(new BasicText(doc,var_QI_Insert_company));
insurance.appendChild(var_QI_Insert_tempElement);
var_QI_Insert_tempElement = new BasicElement(doc,“policynumber”);
var_QI_Insert_tempElement.appendChild(new BasicText(doc,var_QI_Insert_policynumber));
insurance.appendChild(var_QI_Insert_tempElement);
patient.appendChild(insurance);
BasicElement submitted = new BasicElement(doc,“submitted”);
var_QI_Insert_tempElement = new BasicElement(doc,“date”);
var_QI_Insert_tempElement.appendChild(new BasicText(doc,var_QI_Insert_date));
submitted.appendChild(var_QI_Insert_tempElement);
var_QI_Insert_tempElement = new BasicElement(doc,“symptoms”);
var_QI_Insert_tempElement.appendChild(new BasicText(doc,var_QI_Insert_symptoms));
submitted.appendChild(var_QI_Insert_tempElement);
var_QI_Insert_tempElement = new BasicElement(doc,“diagnosis”);
var_QI_Insert_tempElement.appendChild(new BasicText(doc,var_QI_Insert_diagnosis));
submitted.appendChild(var_QI_Insert_tempElement);
BasicElement doctor = new BasicElement(doc,“doctor”);
name = new BasicElement(doc,“name”);
var_QI_Insert_tempElement = new BasicElement(doc,“surname”);
var_QI_Insert_tempElement.appendChild(new BasicText(doc,var_QI_Insert_surname_doc));
name.appendChild(var_QI_Insert_tempElement);
var_QI_Insert_tempElement = new BasicElement(doc,“firstname”);
var_QI_Insert_tempElement.appendChild(new BasicText(doc,var_QI_Insert_firstname_doc));
name.appendChild(var_QI_Insert_tempElement);
var_QI_Insert_tempElement = new BasicElement(doc,“title”);
var_QI_Insert_tempElement.appendChild(new BasicText(doc,var_QI_Insert_title));
name.appendChild(var_QI_Insert_tempElement);
doctor.appendChild(name);
submitted.appendChild(doctor);
patient.appendChild(submitted);
BasicElement therapy = new BasicElement(doc,“therapy”);
BasicElement medication = new BasicElement(doc,“medication”);
var_QI_Insert_tempElement = new BasicElement(doc,“type”);
var_QI_Insert_tempElement.appendChild(new BasicText(doc,var_QI_Insert_type));
medication.appendChild(var_QI_Insert_tempElement);
var_QI_Insert_tempElement = new BasicElement(doc,“dosage”);
var_QI_Insert_tempElement.appendChild(new BasicText(doc,var_QI_Insert_dosage));
medication.appendChild(var_QI_Insert_tempElement);
therapy.appendChild(medication);
patient.appendChild(therapy);
var_QI_Insert_tempElement = new BasicElement(doc,“remarks”);
var_QI_Insert_tempElement.appendChild(new BasicText(doc,var_QI_Insert_remarks));
patient.appendChild(var_QI_Insert_tempElement);
TaminoClient.printTree(patient);
// String var_QI_Insert_collection = “Hospital”;
// String var_QI_Insert_doctype = “patient”;
TaminoResult tr= tamino.insert(patient,var_QI_Insert_collection,var_QI_Insert_doctype);
tamino.commit(false);
}
catch (TaminoError e){
System.out.println("Tamino Error Text: " + e.errorText );
System.out.println("Tamino Error Code: " + e.responseCode );
}
}
}