Insert problem

Hello All,
I am trying to insert a record in Tamino using docuverse DOM APIs.I am creating an Element using BasicElement mathods and trying to insert the Element.
TaminoClient.printTree(patient); method shows that Element matches the schema which is defined to the database.But while inserting it doesn’t insert all the node only first three nodes in insert.If I use Tamoni Interactive interface then Data is getting inserted properly but through API it doesn’t go properly.
TaminoResult tr
= tamino.insert(patient, name_collection, name_doctype);

Please provide your suggestions.

regards
Navinder

I’m having a hard time visualising this. Particularly
“.But while inserting it doesn’t insert all the node only first three nodes in insert.”

Could you post the code you use to build up the data? Do you get an error response?

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 );
}
}


}

Your code includes this line…

code:

var_QI_Insert_tempElement = new BasicElement(doc,“***”);


…which creates an element called ***. This is not a valid name for an XML Element. Tamino complains with Response 8710 (invalid token or document incomplete) when you try to store the document with Insert(), but your code doesn’t check the result object so you didn’t see the error.

The fix is in two parts:
1) give this element a valid name.
2) use something like System.out.println(tr.toString()); to check your TaminoResponse.

Cheers,
Bill

That is *** actually.it is “***” which is correct as per DTD.When I do
TaminoClient.printTree(patient);
It shows the proper tree formed with all the node vallues which I am inserting, but when querying it showing only few elements inserted not all.
any ideas!!

Oh no!! it is S_E_X…remove underscores…when I post it without underscores…it is replacing it with ***.

OK - Now I understand the *** problem, but did you examine the TaminoResult object yet?

When I say
System.out.println("Errors : "+tr.toString());
after the insert…then this is what I get, which doen’t seem to be saying any errors, but still the problem is same.

Errors : Return Value: 0
Message Text: null
Message Line: null
Ino Code : null

I tested your code here with Tamino 3.1.1.1 and the TaminoClient.jar that comes with it. I had to change your code to import com.softwareag.tamino.API.dom.;
and then it worked fine. All my data was stored. I noticed your code imports
com.softwareag.tamino.API.dom2.
;
I’m not sure what that is. Have you tried with …API.dom.*?
The only other things I can think of are:
What Tamino version are you running, and
What is your schema? Can you please post it?

Yeah Bill, with TaminoClient.jar it’s working fine.That dom2 API I got from this forum.That works fine for everything else.Anyway…problem seems to be solved now.
Thanks a lot,
regards!!