This appendix discusses three applications of XML in SQL. These applications are organized in three layers:
Transact-SQL statements such as insert, select, and update for referencing SQL variables that contain XML document data. These SQL operations use Java classes and methods to manipulate the XML documents.
Java classes to contain XML documents and to access and update the elements of these documents. There is an application-specific class for the Order document type and a general class for arbitrary SQL result sets.
An XML parser, which is used by the Java classes to analyze and manipulate XML documents.
The Java classes that are used in this appendix to demonstrate XML applications are JXml, OrderXml, and ResultSetXml.
JXml stores and parses XML. It does not validate XML documents. It is designed as a base class for subclasses that:
Validate specific XML document types
Provide application-oriented methods
OrderXml and ResultSetXml are two such subclasses.
OrderXml illustrates support for an application-specific XML document type. OrderXml validates Order documents for the Order DTD. You can use OrderXml methods to reference and update elements of the Order document.
ResultSetXml represents SQL result sets. The ResultSetXml constructor validates the ResultSet document for the ResultSet DTD. ResultSetXml methods are used to reference and update elements of the ResultSet document.
ResultSetXml illustrates support for a general XML document type capable of representing arbitrary SQL data.
“The OrderXml class for Order documents” and “The ResultSetXml class for result set documents” describe these classes and their methods and parameters. For Javadoc HTML pages with detailed specifications for the classes and for source code, refer to $ASDIR/sample/JavaSql (UNIX) or %ASDIR%\sample\JavaSql (Windows).