
queryProperties.setFormat("GENERATE_AS_ELEMENTS"); queryProperties.setRecurse(false);
}
Executing the SQLToXML class
We created the doQuery method to execute the query and get an XML Document as a result (Example
Tip: A future release of Application Developer contains a method to get a document. We tested this method and it works. When it is available, you can get a document directory from SQLToXML.
Example 11-8 CustomerXSLServlet doQuery method
//For Application Developer 4.0.3
private StringWriter doQuery(HttpServletRequest request){ StringWriter xmldata = new StringWriter(); PrintWriter xmlwr = new PrintWriter(xmldata);
try{
sql2xml.execute(new java.lang.String( request.getParameter("memberhsip")),xmlwr,null,null,null);
}catch(Exception exception){ System.out.println(exception);
}
return xmlData;
}
//For Application Developer 5.0
private org.w3c.dom.Document doQuery(HttpServletRequest request){ StringWriter xmldata = new StringWriter();
PrintWriter xmlwr = new PrintWriter(xmldata);
try{
sql2xml.setParameters(new java.lang.String( request.getParameter("memberhsip")));
sql2xml.execute();
}catch(Exception exception){ System.out.println(exception);
}
return sql2xml.getDocument();
}
272 The XML Files: Development of XML/XSL Applications Using WebSphere Studio