hi,
I got the error...(Constructor is not visible)..
here is my code...
*****
import java.io.FileWriter;
import java.io.IOException;
import org.apache.struts.action.*;
import javax.servlet.http.*;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.xmldb.api.*;
import org.w3c.dom.*;
import com.sleepycat.dbxml.*;
public class InsertInvoiceInfoAction extends Action{
String Idxml ;
String stDate = null;
String stNumber = null ;
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
String target = new String("success");
if ( form != null ) {
InvoiceInfoForm iif = (InvoiceInfoForm)form;
stDate = iif.getInvDate();
stNumber = iif.getInvNumber();
}
if ( form == null ) {
System.out.println("form is null...in insertInvocieInfoAction class");
}
if (( stDate == null )|| (stNumber == null) ){
System.out.println("date or invNumber is null ");
target = new String("failure");
}
else {
writeXmlToBerkeleyDatabase("InvDetails");
}
return (mapping.findForward(target));
}
public void writeXmlToBerkeleyDatabase(String Idxml)throws Exception {
XmlManager myManager = null;
XmlContainer myContainer = null;
try {
DocumentBuilderFactory dbf =DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc1 = db.newDocument();
Element main,root,outitem;
main = doc1.createElement("Document");
main.appendChild(doc1.createTextNode("\n"));
outitem = doc1.createElement("inv-date");
outitem.appendChild(doc1.createTextNode(stDate));
main.appendChild(outitem);
main.appendChild(doc1.createTextNode("\n"));
outitem = doc1.createElement("inv-number");
outitem.appendChild(doc1.createTextNode(stNumber));
main.appendChild(outitem);
main.appendChild(doc1.createTextNode("\n"));
doc1.appendChild(main);
String docString =doc1.toString();
// Here i get the error
XmlDocument myXmlDoc =
new XmlDocument();
// The Constructor XmlDocument is not visible
myXmlDoc.setContent(docString);
myManager = new XmlManager();
myContainer =
myManager.openContainer("myContainer4.bdbxml");
myContainer.putDocument(Idxml, docString, null,0);
System.out.println("Document inserted ====> " + docString);
} catch (Exception e) {
System.out.println(e.getMessage() + e.toString());
}
finally {
try {
if (myContainer != null) {
myContainer.close();
}
if (myManager != null) {
myManager.close();
}
} catch (Exception ce) {
System.out.println(ce.getMessage() + ce.toString());
}
}
}// end writexmlToBerkeleyDatabase
}
******
Thanks in advanced..
ketan
I got the error...(Constructor is not visible)..
here is my code...
*****
import java.io.FileWriter;
import java.io.IOException;
import org.apache.struts.action.*;
import javax.servlet.http.*;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.xmldb.api.*;
import org.w3c.dom.*;
import com.sleepycat.dbxml.*;
public class InsertInvoiceInfoAction extends Action{
String Idxml ;
String stDate = null;
String stNumber = null ;
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
String target = new String("success");
if ( form != null ) {
InvoiceInfoForm iif = (InvoiceInfoForm)form;
stDate = iif.getInvDate();
stNumber = iif.getInvNumber();
}
if ( form == null ) {
System.out.println("form is null...in insertInvocieInfoAction class");
}
if (( stDate == null )|| (stNumber == null) ){
System.out.println("date or invNumber is null ");
target = new String("failure");
}
else {
writeXmlToBerkeleyDatabase("InvDetails");
}
return (mapping.findForward(target));
}
public void writeXmlToBerkeleyDatabase(String Idxml)throws Exception {
XmlManager myManager = null;
XmlContainer myContainer = null;
try {
DocumentBuilderFactory dbf =DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc1 = db.newDocument();
Element main,root,outitem;
main = doc1.createElement("Document");
main.appendChild(doc1.createTextNode("\n"));
outitem = doc1.createElement("inv-date");
outitem.appendChild(doc1.createTextNode(stDate));
main.appendChild(outitem);
main.appendChild(doc1.createTextNode("\n"));
outitem = doc1.createElement("inv-number");
outitem.appendChild(doc1.createTextNode(stNumber));
main.appendChild(outitem);
main.appendChild(doc1.createTextNode("\n"));
doc1.appendChild(main);
String docString =doc1.toString();
// Here i get the error
XmlDocument myXmlDoc =
new XmlDocument();
// The Constructor XmlDocument is not visible
myXmlDoc.setContent(docString);
myManager = new XmlManager();
myContainer =
myManager.openContainer("myContainer4.bdbxml");
myContainer.putDocument(Idxml, docString, null,0);
System.out.println("Document inserted ====> " + docString);
} catch (Exception e) {
System.out.println(e.getMessage() + e.toString());
}
finally {
try {
if (myContainer != null) {
myContainer.close();
}
if (myManager != null) {
myManager.close();
}
} catch (Exception ce) {
System.out.println(ce.getMessage() + ce.toString());
}
}
}// end writexmlToBerkeleyDatabase
}
******
Thanks in advanced..
ketan