How do I use big5 code collection name instead of English collection name in java program?
In tamino tools
“Schema Editor”
I can define the schema with Big5 collection name
“Interactive Interface”
I can Query ,Process infomation with with Big5/GB2312 collection name
Now I use JBuilder to do this:
package toolbox;
// Imports
import com.softwareag.tamino.API.dom.TaminoError;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
public class TaminoWrapper {
// Constructors
public TaminoWrapper() { }
// Methods
public static Document Query(String string, String string1, String string2) throws TaminoError { return null;}
public static void Process(String string, Document document, String string2) throws Exception { }
public static void Process(String string, Element element, String string2) throws Exception { }
}
And ,I use this to do the process work
TaminoWrapper.Process(“Tamino DB URL”,doc,“Collection Name”);
??
And I found that if I use Big5/GB2312 Code here,
The Data will not be put into the DB.
But I can do it with English
(use English collection name).
PS: I am a beginner on this.
Please show me how to do this in detail,thanks.
First thing I see is that the Process() methods are empty. IS there more of your programm then what you posted?
Please post the complete code.
package element2domtree;
import javax.servlet.;
import javax.servlet.http.;
import java.io.;
import java.util.;
//import javax.xml.dom.;
import org.w3c.dom.;
import toolbox.;
//?? DocumentBuilderFactory/DocumentBuilder ???
import javax.xml.parsers.;
//import com.softwareag.tamino.API.dom.*;
/
*
Title:
*
Description:
*
Copyright: Copyright (c) 2002
*
Company:
* @author unascribed
* @version 1.0
/
public class Servletdomtree extends HttpServlet {
static final private String CONTENT_TYPE = “text/html; charset=GBK”;
//Initialize global variables
public void init() throws ServletException {
}
public static String get_name,get_sex,get_shi,get_sheng,get_xian;
//Process the HTTP Post request
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
response.setContentType(CONTENT_TYPE);
response.setContentType(“text/html;charset=GB2312”);
request.setCharacterEncoding(“GB2312”);
try{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
//?
Document doc = builder.newDocument();
response.setContentType(“text/html;charset=GB2312”);
request.setCharacterEncoding(“GB2312”);
get_name=request.getParameter(“name”);
get_sex=request.getParameter("“);
get_sheng=request.getParameter(“sheng”);
get_shi=request.getParameter(“shi”);
//get_xian=request.getParameter(“xian”);
Element root = doc.createElement(”???“);
Element yuangong=doc.createElement(”??“);
Element name=doc.createElement(”??“);
name.appendChild(doc.createTextNode(get_name));
yuangong.appendChild(name);
Element **=doc.createElement(“??”);
.appendChild(doc.createTextNode(get_sex));
yuangong.appendChild();
Element jiguan=doc.createElement(“??”);
Element sheng=doc.createElement(“?”);
sheng.appendChild(doc.createTextNode(get_sheng));
jiguan.appendChild(sheng);
Element shi=doc.createElement(“?”);
shi.appendChild(doc.createTextNode(get_shi));
jiguan.appendChild(shi);
/
Element xian=doc.createElement(”?“);
xian.appendChild(doc.createTextNode(get_xian));
jiguan.appendChild(xian);
/
yuangong.appendChild(jiguan);
/
root
yuangong
name
**
jiguan
sheng
shi
xian
/
root.appendChild(yuangong);
doc.appendChild(root);
/
if I use englidh letters here I could import
the data into tamino
/
TaminoWrapper.Process
(“http://localhost/tamino/employeeinfo",doc,"???”);
System.out.println(DOMWrapper.writeToXML(root));
com.softwareag.tamino.API.dom.TaminoClient.printTree(root);
System.out.println(DOMWrapper.writeToXML(jiguan));
// Show the ino:id of the document just inserted
//System.out.println( “Insert succeeded, ino:id=” + xmlObject.getId() );
}
catch(Exception e2){
System.out.println(“error:” + e2.getMessage());
}
//com.softwareag.tamino.api.dom
PrintWriter out = response.getWriter();
response.setContentType(“text/xml”);
out.println(”<?xml version=\"1.0\" encoding=\"gb2312\"?>“);
out.println(”“);
out.println(”
“+“It is the reply!”+”
“);out.println(”");
}
//Clean up resources
public void destroy() {
}
}
I checked with the other guys. Generally this should be possible. I can’t see from the code you posted, what really is going on.
One thing you could try is to create the collection with BIG5-name using the Tamino Explorer Tool.
The other thing could be to reduce your sample to a short program (a few lines), which shows the problem.