title: How can I insert an XML document in PostgreSQL in Java?
body: <p>I have a table in Postgresql </p>
  
  <pre><code>DROP TABLE xml_docs;
  CREATE TABLE xml_docs(
  id serial PRIMARY KEY,
  cad_number character(50),
  gkuzu_name character(50),
  gkuzu xml,
  rreq_name character(50),
  rreq xml
  )
  </code></pre>
  
  <p>I use JDBC for data base connection. And i want to insert whole xml document in table.<br>
  How can i make this?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Okey. i try </p>
  
  <pre><code>  String sql = "INSERT INTO xml_docs(cad_number,gkuzu_name,gkuzu,rreq_name,rreq) VALUES(?,?,?,?,?)";
    PreparedStatement stmt = ce.prepareStatement(sql);
    stmt.setString(1, "11:33:5464563");
    stmt.setString(2, xml_gkuzu.getName());
    stmt.setString(3, xml_gkuzu.toString());
    stmt.setString(4, xml_rreq.getName());
    stmt.setString(5, xml_rreq.toString());
    stmt.executeQuery();
  ce.close();
    se.close();
  </code></pre>
  
  <p>and get exeption </p>
  
  <pre><code>Exception in thread "main" org.postgresql.util.PSQLException: ERROR: column "gkuzu" is of type xml but expression is of type character varying
  Подсказка: You will need to rewrite or cast the expression.
  </code></pre>
  
  <p>Whats wrong?</p>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p>When i try do this </p>
  
  <pre><code> String sql1 = "INSERT INTO xml_docs(cad_number,gkuzu_name,gkuzu,rreq_name,rreq) VALUES(11335464563,"+xml_gkuzu.getName()+",XMLPARSE("+xml_gkuzu.toString()+"),"+xml_rreq.getName()+",XMLPARSE("+xml_rreq.toString()+"))";
  </code></pre>
  
  <p>i get exeption</p>
  
  <pre><code>Exception in thread "main" org.postgresql.util.PSQLException: ERROR: syntax error at or near "bf48e000b0"
  </code></pre>