Chapter 11. Light weight XML-based Enterprise Application 281
{
if(datasource != null ){
super.setConnection(datasource.getConnection());
}
if( !(doc.getFirstChild().getNodeName().equalsIgnoreCase("SQLResult"))
){
Element rootElement = doc.createElement("SQLResult");
rootElement.appendChild(doc.getFirstChild());
doc.appendChild(rootElement);
}
super.execute(doc,continueOnSQLError);
}
If this Documents root element i s not SQLResult, add SQLResult, and add the
first child (in our case, it is customer), to the SQLResult element. At this time, the
customer element was removed from the root and is a child of the SQLResult.
Then add the SQLResult to the document, SQLResult will be a root, and
customer will be a first child.
11.3.7 Conclusion
SQLToXML and XMLToSQL can be the XML front end of the database. Using
these libraries, we can use the XML data as the core data of the application
(Figure11-11).
Figure 11-11 Core data is an XML
You have seen how to use Application Developer to:
򐂰Update the database with dynamically generated XML within a servlet using
XMLToSQL class library.
Browser
SQLToXML
XMLToSQL

DB

DB

XML
Data
XSLT Processor
Servlet