The XMLtoString() examples

The following example converts three XML documents to character strings and then uses the strings as parameter values in an SQL INSERT statement:
PreparedStatement p = conn.prepareStatement("insert into tab
   values(?,?,?)");
p.setString(1, UtilXML.XMLtoString("/home/file1.xml"));
p.setString(2, UtilXML.XMLtoString("http://server/file2.xml");
p.setString(3, UtilXML.XMLtoString("file3.xml");
The following example inserts an XML file into an LVARCHAR column. In this example, tab1 is a table created with the SQL statement:
create table tab1 (col1 lvarchar);
The code is:
try
   {
   String cmd = "insert into tab1 values (?)";
   PreparedStatement pstmt = conn.prepareStatement(cmd);
   pstmt.setString(1, UtilXML.XMLtoString("/tmp/x.xml"));
   pstmt.execute();
   pstmt.close();
   }
    catch (SQLException e)
   {
   // Error handling
   }