Interstage Shunsaku Data Manager Application Development Guide - Microsoft(R) Windows(R) 2000/ Microsoft(R) Windows Server(TM) 2003 - - UNIX -
|
Contents
Index

|
12.5.2.1 Procedure for Converting Data in a Database to XML Documents
The following figure shows the procedure used to convert data in a database to XML documents.
[Figure 12-8 Procedure Used to Convert Database Data to XML Documents]

- Connect to database
Send a request to connect to the database and establish the connection.
- Create ResultSet object
Use SQL to perform database searches and obtain the ResultSet object

The XML conversion function is for the ResultSet object that can be scrolled.
If the Statement object is created by JDBC, and the TYPE_FORWORD_ONLY is specified at the constant number in ResultSet class, the error will be output by the XML conversion function when there is no data in the ResultSet.
In this case, specify TYPE_SCROLL_SENSITIVE or TYPE_SCROLL_INSENSITIVE.
- Create GeneratorMap object
Specify a mapping rules file and create the GeneratorMap object.
- Create XMLGenerator object
Create the XMLGenerator object.
- Create DocumentFountain object
Invoke the document creation method for the XMLGenerator object, createDocumentFountain(). When doing so, specify the ResultSet object and the GeneratorMap object, the output format and the information needed for the output format as arguments. This will cause the DocumentFountain object to be created and returned to the application. Note that the output format of the XML documents extracted from the DocumentFountain object is determined at this time.
- Set character code used during output
Invoke the character code setting method for the DocumentFountain object, setCode(), from the application. Specify the character code of the XML documents to be created.
When no character code is specified, the use of UTF-8 is assumed by default.
- Output XML documentsInvoke the document extraction method for the DocumentFountain object, getXMLDocument(), Receive the XML documents in one of the following formats:
- String
- Stream
- File
- DOM tree
- SAX
More than one set of XML documents can be created from a single ResultSet object by invoking the document extraction method getXMLDocument() more than once. The XML documents will be created and returned to the application in sequence.
All Rights Reserved, Copyright(C) FUJITSU LIMITED 2006