Jxtug
Jxtug
User’s Guide
March 2002
© 2002 DataDirect Technologies. All rights reserved. Printed in the U.S.A.
No part of this publication, with the exception of the software product user
documentation contained in electronic format, may be copied, photocopied,
reproduced, transmitted, transcribed, or reduced to any electronic medium or
machine-readable form without prior written consent of DataDirect Technologies.
DataDirect Technologies
3202 Tower Oaks Blvd. Suite 300
Rockville, Maryland 20852
3
Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
What Is DataDirect jXTransformer? . . . . . . . . . . . . . . . . . . . . . 9
Using This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Conventions Used in This Book. . . . . . . . . . . . . . . . . . . . . . . . . 11
About DataDirect Documentation . . . . . . . . . . . . . . . . . . . . . . 13
Contacting Technical Support . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1 jXTransformer Overview . . . . . . . . . . . . . . . . . . . . . . 17
jXTransformer Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Transforming Relational Data into XML . . . . . . . . . . . . . . . . . 18
jXTransformer Query Example . . . . . . . . . . . . . . . . . . . . . . 19
jXTransformer Builder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Using jXTransformer Queries in JDBC Applications . . . . . . 22
Updating Your Database With Data From XML . . . . . . . . . . . 23
jXTransformer Write Statement Example . . . . . . . . . . . . . 24
Using jXTransformer Write Statements in
JDBC Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2 Understanding jXTransformer . . . . . . . . . . . . . . . . . 29
Using jXTransformer Queries . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Creating Hierarchical XML Documents. . . . . . . . . . . . . . . . 29
Using Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Hiding Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Creating ID/IDREFS Links . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Creating XML Document Fragments . . . . . . . . . . . . . . . . . 36
Generating DTDs and Schemas . . . . . . . . . . . . . . . . . . . . . . 38
Choosing an XML Document Structure . . . . . . . . . . . . . . . 39
xml_hide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
select_expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
rest_of_sql99_select . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Rules and Exceptions for jXTransformer Query Syntax . . . . . 127
Executing jXTransformer Queries . . . . . . . . . . . . . . . . . . . . . . 127
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Preface
NOTE: This book refers the reader to Web URLs for more
information about specific topics, including Web URLs not
maintained by DataDirect Technologies. Because it is the nature
of Web content to change frequently, DataDirect Technologies
can guarantee only that the URLs referenced in this book were
correct at the time of publishing.
Typographical Conventions
This guide uses the following typographical conventions:
Convention Explanation
italics Introduces new terms that you may not be
familiar with, and is used occasionally for
emphasis.
Convention Explanation
bold Emphasizes important information. Also
indicates button, menu, and icon names on
which you can act. For example, click Next.
UPPERCASE Indicates the name of a file. For operating
environments that use case-sensitive
filenames, the correct capitalization is used in
information specific to those environments.
Also indicates keys or key combinations that
you can use. For example, press the ENTER
key.
monospace Indicates syntax examples, values that you
specify, or results that you receive.
monospaced Indicates names that are placeholders for
italics values you specify; for example, filename.
forward slash / Separates menus and their associated
commands. For example, Select File / Copy
means to select Copy from the File menu.
vertical rule | Indicates an OR separator to delineate items.
brackets [ ] Indicates optional items. For example, in the
following statement: SELECT [DISTINCT],
DISTINCT is an optional keyword.
braces { } Indicates that you must select one item. For
example, {yes | no} means you must specify
either yes or no.
ellipsis . . . Indicates that the immediately preceding item
can be repeated any number of times in
succession. An ellipsis following a closing
bracket indicates that all information in that
unit can be repeated.
Mouse Conventions
This action… Means to…
Click Point to an object with the mouse pointer
and press the left mouse button.
Double-click Click the left mouse button twice.
Right-click Click the right mouse button.
Drag Press and hold the left mouse button while
dragging item(s) to another part of the
screen.
SHIFT+Click Press and hold the SHIFT key; then click a
selection. This lets you select a series of
objects.
CTRL+Click Press and hold the CTRL key; then click a
selection. This lets you select objects
randomly.
Keyboard Conventions
Select menu items by using the mouse or pressing ALT+ the key
letter of the menu name or item.
http://www.datadirect-technologies.com/download/docs/
dochome.asp
E-Mail
USA, Canada, Mexico, [email protected]
Australia, and Asia
Pacific (except Japan)
Japan [email protected]
All other countries [email protected]
Fax Information
Fax US 1 919 461 4527
Fax International +32 (0) 15 32 09 19
1 jXTransformer Overview
jXTransformer Support
jXTransformer supports the following features:
■ Read and write access to any relational database supported
by the DataDirect JDBC driver. Refer to your DataDirect
product README for details about which DataDirect JDBC
drivers support jXTransformer.
■ Creation of simple or complex hierarchical XML documents
and XML document fragments.
each project by employee and their billable hours. You also can
create another jXTransformer query that lists each employee by
their project assignment and billable hours.
<Employees_Info ID='456322'>
<name>
<first>Roger</first>
<last>Jones</last>
</name>
<title>Sales Representative</title>
<hiredate>2000-02-01</hiredate>
<salary>80000</salary>
</Employees_Info>
</result>
jXTransformer Builder
The jXTransformer Builder is a graphical user interface tool that
helps you create and modify jXTransformer queries quickly
without having to know the syntax of the jXTransformer
grammar. You can also use the jXTransformer Builder to check
the syntax of your jXTransformer query before you use it in your
JDBC applications. You can save the jXTransformer query as a
jXTransformer Builder project file for future fine-tuning or reuse.
1 2
5
jXTransformer
API
5
3 4
DataDirect XML
JDBC Driver Document
3 4
RDBMS
You can use the jXTransformer Builder to create, modify, and test
jXTransformer queries. When you are satisfied with your query,
you can cut and paste the jXTransformer query from the
jXTransformer Query window of the Builder or from a text file
into a JDBC application. For more information about coding a
jXTransformer query within a JDBC application, see “Coding
jXTransformer Queries and Write Statements in JDBC
Applications” on page 158.
The values for the columns are retrieved from the following XML
document named emp.xml:
<?xml version="1.0" encoding="UTF-8"?>
<insert>
<employee ID="21" FirstName="Anne" LastName="Dodsworth"
Title="Miss" StartDate="2001-10-24" HourlyRate="115">
<resume><![CDATA[
<a href=’http://www.xesdemo/resume/21.htm’>
A. Dodsworth</a>]]></resume>
<benefits>
<benefit ID="1" Amount="1"
<benefit ID="2" Amount="175" StartDate="2001-11-01"/>
</benefits>
<projects>
<project ID="8">
<task>Analysis</task>
<task>Development</task>
</project>
<project ID="9">
<task>Analysis</task>
</project>
</projects>
</employee>
</insert>
Insert statement:
insert xml_document(’emp.xml’, 1)
into Employees (EmpId, FirstName, LastName, Title,
StartDate, HourlyRate, Resume)
xml_row_pattern(’/insert/employee’)
values(xml_xpath(’@ID’, 0, ’Integer’),
xml_xpath(’@First’),
xml_xpath(’@LastName’),
xml_xpath(’@Title’),
xml_xpath(’@StartDate’, ’Timestamp’),
xml_xpath(’@HourlyRate’, ’Integer’),
xml_xpath(’resume[1]/text()’)
)
into EmpBenefits (BenefitId, EmpId, Amount, StartDate)
xml_row_pattern(’/insert/employee/benefits/benefit’)
values(xml_xpath(’@ID’, ’Integer’),
xml_xpath(’../../@ID’, ’Integer’),
xml_xpath(’@Amount’, ’Integer’),
xml_xpath(’@StartDate’, ’Timestamp’)
)
into Assignments (ProjId, EmpId, Task)
xml_row_pattern(’/insert/employee/projects/project/task’)
values(xml_xpath(’../@ID’, ’Integer’),
xml_xpath(’../../../@ID’, ’Integer’),
xml_xpath(’text()’)
)
Results:
1 2 5
jXTransformer
API
3
4 5
DataDirect XML
JDBC Driver Document
4 5
RDBMS
2 Understanding jXTransformer
XML result:
<Employees_Info Department=’QA’>
<name>
<first>Paul</first>
<last>Steward</last>
</name>
</Employees_Info>
<Employees_Info Department=’QA’>
<name>
<first>John</first>
<last>Jenkins</last>
</name>
</Employees_Info>
XML result:
<employee ID=’1’ name=’Marc Marshall’
<project name=’Medusa’ task=’Analysis’ />
<project name=’Phoenix’ task=’Analysis’ />
</employee>
<employee ID=’2’ name=’Brian Ayers’
<project name=’Medusa’ task=’Documentation’ />
<project name=’Phoenix’ task=’Documentation’ />
</employee>
Using Keys
You can optimize processing of a jXTransformer query by
specifying key columns using the "key" keyword. If you do not
specify any key columns, jXTransformer automatically assumes
that all of the selected columns concatenated together compose
the key. Notice that the key columns are used to link parent rows
to child rows when you are using jXTransformer nested queries.
In jXTransformer queries that do not contain nested queries,
there is no need to specify key columns.
XML result:
<employee name=’Marc Marshall’
<project name=’Medusa’ task=’Analysis’ />
<project name=’Phoenix’ task=’Analysis’ />
</employee>
<employee name=’Brian Ayers’
<project name=’Medusa’ task=’Documentation’ />
<project name=’Phoenix’ task=’Documentation’ />
</employee>
Hiding Information
The jXTransformer query xml_hide[_key] constructor allows you
to select and "hide" database columns you do not want to
display in the resulting XML document. For example, suppose
you have a database table that contains the following employee
information:
From this database table, you want to retrieve the names and
salaries of the employees in the "QA" department as well as list
dependents for those employees. In this case, to optimize
processing, you want to write a jXTransformer query that selects
the SSN column (a primary key), but you do not want to display
the SSN information in the XML document, so you use the
xml_hide_key construct to select the SSN data. The
jXTransformer query could look like:
select
xml_element(’QAemployees’,
xml_hide_key(e.SSN),
xml_element(’Salaries’,
xml_element(’first’, e.FirstName),
xml_element(’last’, e.LastName),
xml_element(’salary’, e.Salary) )
(select
xml_element(’children’,
xml_attribute(’first-name’, c.first),
xml_attribute(’last-name’, c.last) )
from Employees C where c.ParentSSN=e.SSN) )
from Employees e where e.Department=’QA’
select
xml_element(’employees’,
xml_attribute_key(’emp-id’,
{fn concat(’e-’,{fn convert(e1.EmpId,VARCHAR)})}),
xml_attribute(’emp-name’,e1.LastName),
First query
xml_attribute(’emp-benefits’,
select
{fn concat(’b-’,
Creates IDREFS {fn convert(eb1.BenefitId,VARCHAR)})}
from EmpBenefits eb1 where eb1.EmpId=e1.EmpId))
from Employees e1 where exists
(select * from EmpBenefits eb2 where e1.EmpId=eb2.EmpId)
Semicolon separating ;
queries select
xml_element(’benefits’,
xml_attribute_key(’benefit-id’,
{fn concat(’b-’,
{fn convert(b2.BenefitId,VARCHAR)})}),
xml_attribute(’benefit-description’,b2.Description),
xml_attribute(’benefit-employees’,
Second query select
{fn concat(’e-’,
{fn convert(eb3.EmpId,VARCHAR)})}
Creates IDREFS from EmpBenefits eb3
where eb3.BenefitId=b2.BenefitId))
from Benefits b2
where exists
(select * from EmpBenefits eb4
where b2.BenefitId=eb4.BenefitId)
XML result:
<employees emp-id="e-1" emp-name="Marshall"
emp-benefits="b-1 b-3" />
<employees emp-id="e-12" emp-name="Steward"
emp-benefits="b-3" />
<employees emp-id="e-2" emp-name="Allen"
emp-benefits="b-1 b-4" />
<benefits benefit-id="b-1" benefit-description="Bonus"
benefit-employees="e-1 e-2" />
<benefits benefit-id="b-3" benefit-description="Car"
benefit-employees="e-1 e-12" />
<benefits benefit-id="b-4" benefit-description="Commission"
benefit-employees="e-2" />
The JDBC application code required for this scenario might look
something like:
import java.io.OutputStreamWriter;
import java.sql.*;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import com.ddtek.jxtr.*;
{
//Load properties from the resource
loadProperties();
// Execute and place the result into the previously created DOM node
jxtrQuery.executeDOM ( domS1 );
Hierarchical XML
For hierarchical XML documents, all data retrieved from the
database is structured as defined by parent and child
relationships, and nested queries, using the jXTransformer query
grammar. The JXTRQuery class implements the methods to
transform a jXTransformer query into an XML structured
document. Refer to “Creating Hierarchical XML Documents” on
page 29 for more information about structured XML.
• You must use the nested loop rewrite algorithm when you
specify an Order By clause that sorts data based on a
column expression not selected from the database. For
NOTE: When you switch between Tree view and Text view, the
Builder checks the syntax of your query and generates a message
if an error is encountered. If an error is encountered, you cannot
switch views until you correct the error.
In Figure 3-3, the Base SQL Query node contains the following
SQL92 query:
select
e.EmpId,
e.FirstName,
e.LastName,
e.StartDate,
e.EndDate,
e.Resume
from Employees e where e.EmpId in (12,14)
NOTE: When you turn off the document header, the ROOT
ELEMENT node, and any COMMENT, PROCESSING INSTRUCTION,
and EXTERNAL DTD nodes are deleted.
Type a name for the new driver, and click OK. The fields in
the Driver group on the Drivers tab become active.
To delete a named driver, select the driver from the Name group,
and click the Delete button. Click OK to confirm the deletion.
NOTE: When you turn off the document header, the ROOT
ELEMENT node, and any COMMENT, PROCESSING INSTRUCTION,
and EXTERNAL DTD nodes are deleted.
Specifying Comments
You can specify one or multiple comments in the document
header only. Comments are specified in the Tree view of the
Builder by using COMMENT nodes, with the project node as the
parent. To specify multiple comments, create multiple COMMENT
nodes, one for each comment.
To specify a comment:
1 Select the project node, and select Insert / Comment. The
Comment Node dialog box appears:
To view a DTD, you can open the DTD in the Open DTD window.
For information on opening DTDs, see “Opening an XML DTD”
on page 97.
3 Click OK.
The Builder checks the SQL99 query for syntax. If an error is
detected, a dialog box appears describing the error. If no
errors are detected, a Base SQL Query node appears in the
project tree.
Once a Base SQL Query node is created, you can construct the
jXTransformer query based on the Base SQL Query node,
Select Expression
1 Right-click a Base SQL Query node or an ELEMENT node, and
select Insert / Element Node / as Select Expression. The
Element Node dialog box appears.
Constant
1 Right-click a Base SQL Query node or an ELEMENT node, and
select Insert / Element Node / as Constant. The Element Node
dialog box appears.
4 Click OK. The ELEMENT node appears in the project tree with
a CONSTANT node as its child.
Empty
1 Right-click a Base SQL Query node or an ELEMENT node, and
select Insert / Element Node / Empty. The Element Node
dialog box appears.
Select Expression
1 Right-click an ELEMENT node, and select Insert / Attribute
Node / as Select Expression. The Attribute Node dialog box
appears.
Constant
1 Right-click an ELEMENT node and select Insert / Attribute
Node / as Constant. The Attribute Node dialog box appears.
SQL Query
1 Right-click an ELEMENT node and select Insert / Attribute
Node / as SQL Query. The Attribute Node dialog box appears.
Select Expression
1 Right-click the Base SQL Query node or an ELEMENT node,
and select Insert / CDATA Node / as Select Expression. The
CDATA Node dialog box appears.
Constant
1 Right-click the Base SQL Query node or an ELEMENT node,
and select Insert / CDATA Node / as Constant. The CDATA
Node dialog box appears.
2 In the Value field, type a constant value or click the From File
button to navigate to a file containing the constant value.
This can be any character string literal, such as 8 or TRUE.
To specify a namespace:
1 Right-click an ELEMENT node or a ROOT ELEMENT node, and
select Insert / Namespace Node. The Namespace Node dialog
box appears.
Modifying Nodes
Right-click the node you want to modify, and select Edit. Change
the information in the dialog box as necessary. When you are
satisfied with your changes, click OK.
NOTES:
■ You cannot modify a project node.
■ Changes to a validated Base SQL Query node may invalidate
nodes in the project tree.
■ For ELEMENT nodes, you can only change the name of the
node because ELEMENT nodes can contain multiple value
nodes.
Moving Nodes
Select the node you want to move. Then, drag and drop the node
to the location you want it to appear in the project tree.
NOTES:
■ You cannot move a project node.
■ The Builder restricts moves to valid choices as defined by the
jXTransformer query grammar.
Deleting Nodes
Right-click the node you want to delete and select Delete. If the
selected node has children, a window appears asking you to
confirm the deletion of the node and all its children. To confirm,
click OK.
NOTES:
■ When you delete a parent node with children nodes, the
children nodes are deleted also.
■ You cannot delete a project node.
To open a DTD:
1 Select File / Open DTD. The Open DTD dialog box appears.
2 In the Path field, select a path to the DTD you want to open
from the drop-down list, type the path, or click the ... button
to browse and select a DTD.
3 Click OK. The DTD View window opens with the path and
name of the DTD displayed in the top-level node.
Generating a DTD
1 With a jXTransformer query open, select Project / Create DTD
from query. The Open JDBC Connection dialog box appears.
4 Syntax of jXTransformer
Queries
xml_document
xml_document indicates that a complete XML document will be
created by the jXTransformer query instead of an XML document
fragment. A complete XML document contains an XML root
element. If you do not specify this constructor in your
jXTransformer query, a document fragment will be created. The
xml_document constructor is followed by xml_document_info,
which is discussed next.
xml_document_info
The xml_document_info section of a jXTransformer query allows
you to perform the following tasks:
■ Define an XML root element, which creates a complete XML
document as opposed to an XML document fragment.
Within the XML root element, you can define one or multiple
XML attributes, one or multiple XML namespaces, or one or
more of either.
■ Enter one or multiple comments in the XML document
header. This is an optional component of the
xml_document_info section.
■ Specify one or multiple sets of processing instructions. This is
an optional component of the xml_document_info section.
■ Reference one private or public external DTD. This is an
optional component of the xml_document_info section.
Syntax xml_document_info ::= [xml_comment(’comment’) |
xml_pi(’target’, ’instruction’) |
xml_external_dtd([’public_id’,] ’system_uri’)
{, xml_comment(’comment’) |
, xml_pi(’target’, ’instruction’) |
, xml_external_dtd( [’public_id’,] ’system_uri’) } ]
xml_element (’root_element_name’ [,
xml_attribute (’attribute_name’,’attribute_value’) |
xml_namespace ([’prefix’,] ’uri’)]
{, xml_attribute (’attribute_name’,’attribute_value’) |
, xml_namespace ([’prefix’,] ’uri’) } ] )
where:
XML Result:
<!--Example XML result-->
<?xml-stylesheet type="text/xsl" href="file://myxsl.xsl" ?>
<exns:example
rootatt1=’example’
xmlns:"http://www.jxtrdemo/default"
xmlns:exns="http://www.jxtrdemo/example">
<empinfo exns:id=’1’ exns:name=’Marshall’ />
<empinfo exns:id=’2’ exns:name=’Ayers’ />
<empinfo exns:id=’3’ exns:name=’Simpson’ />
<empinfo exns:id=’4’ exns:name=’O'Donnel’ />
<empinfo exns:id=’5’ exns:name=’Jenkins’ />
</exns:example>
xml_constructor
The xml_constructor section of a jXTransformer query allows you
to perform the following tasks:
■ Create XML elements (except for a root element), attributes,
CDATA sections, and namespace definitions.
■ Retrieve data that you do not want included in the resulting
XML document. See “xml_hide” on page 122 for a complete
explanation.
Syntax xml_constructor ::= xml_element | xml_attribute |
xml_cdata | xml_namespace | xml_hide | select_expression
xml_element
The most simple form of xml_element is used to set the value of
an XML element to the value of a database column. For
example:
xml_element (’name’, e.LastName)
xml_element(’Employees_Info’,
xml_attribute(’ID’, e.EmpID),
xml_element(’name’,
xml_element(’first’, e.FirstName),
xml_element(’last’, e.LastName) ) )
where:
XML Result:
<Employees_Info>
<name>
<first>Betty</first>
<last>Jenkins</last>
</name>
</Employees_Info>
<Employees_Info>
<name>
<first>Mike</first>
<last>Johnson</last>
</name>
</Employees_Info>
<Employees_Info>
<name>
<first>Paul</first>
<last>Steward</last>
</name>
</Employees_Info>
<Employees_Info>
<name>
<first>Robert</first>
<last>Healy</last>
</name>
<Employees_Info>
XML Result:
<employee ID=’1’ name=’Marc Marshall’>
<project name=’Medusa’ task=’Analysis’></project>
<project name=’Medusa’ task=’Documentation’></project>
<project name=’Medusa’ task=’Planning’></project>
<project name=’Medusa’ task=’Testing’></project>
<project name=’Phoenix’ task=’Analysis’></project>
<project name=’Phoenix’ task=’Documentation’></project>
</employee>
<employee ID='2' name='Brian Ayers'>
<project name='Hydra' task='Analysis'></project>
<project name='Hydra' task='Documentation'></project>
<project name='Python' task='Analysis'></project>
<project name='Python' task='Development'></project>
</employee>
xml_attribute
Syntax xml_attribute ::= xml_attribute (’xml_attribute_name’,
select_expression | constant | sql99_select) |
xml_attribute_key (’xml_attribute_name’, select_expression)
where:
XML Result:
<Employees_Info ID='12'>
<name>
<first>Paul</first>
<last>Steward</last>
</name>
</Employees_Info>
<Employees_Info ID=’14’>
<name>
<first>John</first>
<last>Jenkins</last>
</name>
</Employees_Info>
xml_cdata
Syntax xml_cdata ::= xml_cdata (select_expression | constant)
where:
XML Result:
<Employees_Info ID='12'>
<name>
<first>Paul</first>
<last>Steward</last>
</name>
<HireDate start=’1997-01-04 00:00:00.0’ />
<![CDATA[ <a href=
’http://www.xesdemo/resume/12.htm’>P.Steward</a>]]>
</Employees_Info>
<Employees_Info ID=’14’>
<name>
<first>John</first>
<last>Jenkins</last>
</name>
<HireDate start=’1990-04-01 00:00:00.0’
end=’1998-01-12 00:00:00.0’ />
<![CDATA[ <a href=
’http://www.xesdemo/resume/14.htm’>J.Jenkins</a>]]>
</Employees_Info>
xml_namespace
Syntax xml_namespace ::= xml_namespace ([’prefix’,] ’uri’)
where:
select
xml_element(’emp:Employees_Info’,
xml_attribute_key(’emp:ID’, e.EmpId),
xml_namespace (’http://mycomp.com/default’),
xml_namespace (’emp’, ’http://mycomp.com/employees’),
xml_element(’emp:name’,
xml_element(’first’, e.FirstName),
xml_element(’last’, e.LastName) ) )
from Employees e where e.EmpId in (12, 14)
XML Result:
<emp:Employees_Info emp:ID='12'
xmlns="http://mycomp.com/default"
xmlns:emp="http://mycomp.com/employees">
<emp:name>
<first>Paul</first>
<last>Steward</last>
</emp:name>
</emp.Employees_Info>
<emp:Employees_Info emp:ID=’14’>
xmlns="http://mycomp.com/default"
xmlns:emp="http://mycomp.com/employees">
<emp:name>
<first>John</first>
<last>Jenkins</last>
</emp:name>
</emp.Employees_Info>
xml_hide
Syntax xml_hide ::= xml_hide[_key] (select_expression)
where:
XML Result:
<Employees_Info>
<name>
<first>Paul</first>
<last>Steward</last>
</name>
</Employees_Info>
select_expression
You can define a jXTransformer query that is similar to a SQL99
query. For example:
select t.a, t.b, t.c from tab t
rest_of_sql99_select
This section of a jXTransformer query allows you to specify the
database table from which the data is retrieved and the
conditions by which the data is retrieved. The From clause defines
the database tables and other optional SQL99 clauses, such as the
Where clause, define the conditions.
Syntax rest_of_sql99_select ::= from_clause [where_clause]
[having_clause] [group_by_clause]
from employees e
and
Query
This section of a jXTransformer query allows you to specify
multiple top-level queries. Additional top-level queries cannot
contain xml_document_info (see “xml_document_info” on
page 109). Multiple top-level queries result in the concatenation
of the results of all top-level queries.
Example The following example uses two top-level queries and uses a
SQL99 query to provide the value of an XML attribute. This
example selects employees that have benefits assigned to them.
For each of the selected employees, a list of benefit IDs is
selected. The second top-level query selects benefit information,
provided at least one employee has the benefit assigned to
them. For each benefit selected, a list of employees that have
the benefit assigned to them is selected.
select
xml_element(’employees’,
xml_attribute_key(’emp-id’,
{fn concat(’e-’,{fn convert(e1.EmpId,VARCHAR)})}),
xml_attribute(’emp-name’,e1.LastName),
xml_attribute(’emp-benefits’,
select
{fn concat(’b-’,
{fn convert(eb1.BenefitId,VARCHAR)})}
from EmpBenefits eb1 where eb1.EmpId=e1.EmpId))
from Employees e1 where exists
(select * from EmpBenefits eb2 where e1.EmpId=eb2.EmpId)
;
select
xml_element(’benefits’,
xml_attribute_key(’benefit-id’,
{fn concat(’b-’,
{fn convert(b2.BenefitId,VARCHAR)})}),
xml_attribute(’benefit-description’,b2.Description),
xml_attribute(’benefit-employees’,
select
{fn concat(’e-’,
{fn convert(eb3.EmpId,VARCHAR)})}
from EmpBenefits eb3
where eb3.BenefitId=b2.BenefitId))
from Benefits b2
where exists
(select * from EmpBenefits eb4
where b2.BenefitId=eb4.BenefitId)
XML Result:
<employees emp-id="e-1" emp-name="Marshall"
emp-benefits="b-1 b-3" />
<employees emp-id="e-12" emp-name="Steward"
emp-benefits="b-3" />
<employees emp-id="e-2" emp-name="Allen"
emp-benefits="b-1 b-4" />
<benefits benefit-id="b-1" benefit-description="Bonus"
benefit-employees="e-1 e-2" />
<benefits benefit-id="b-3" benefit-description="Car"
benefit-employees="e-1 e-12" />
<benefits benefit-id="b-4" benefit-description="Commission"
benefit-employees="e-2" />
Insert Statement
jXTransformer Insert statements insert rows into a relational
database based on column values retrieved from an XML
document. When you define a jXTransformer Insert statement,
you specify:
1 The XML document from which to retrieve values to insert
into the database table. For example:
insert xml_document(’emp.xml’)
2 The database table and columns in which to insert the values.
For example:
into Employees (EmpId, FirstName, LastName, Title,
StartDate, HourlyRate, Resume)
3 The nodes of the XML document from which the values will
be retrieved. For example:
xml_row_pattern(’/insert/employee’)
4 The XML element or attribute of the nodes specified in Step 3
from which to retrieve the values to insert in the database
table. For example:
values(xml_xpath(’@ID’, ’Integer’),
xml_xpath(’@FirstName’),
xml_xpath(’@LastName’),
xml_xpath(’@Title’),
xml_xpath(’@StartDate’, ’Timestamp’),
xml_xpath(’@HourlyRate’, ’Integer’),
xml_xpath(’resume[1]/text()’ )
)
Syntax
The syntax of a jXTransformer Insert statement is as follows:
Syntax jxtr_insert ::= insert xml_document
((’reference_to_xml’ | ?)[, (ignore_whitespace | ?)] )
[xml_namespace ([’prefix’,] ’uri’)
{,xml_namespace ([’prefix’,] ’uri’)}]
{into table_name [(column_list)]
xml_row_pattern((’row_pattern_expression’ | ? ))
jxtr_query_expression
}
where:
where:
The values for the columns are retrieved from the XML document
emp.xml, shown next:
Insert statement:
insert xml_document(’emp.xml’, 1)
into Employees (EmpId, FirstName, LastName, Title,
StartDate, HourlyRate, Resume)
xml_row_pattern(’/insert/employee’)
values(xml_xpath(’@ID’, ’Integer’),
xml_xpath(’@FirstName’),
xml_xpath(’@LastName’),
xml_xpath(’@Title’),
xml_xpath(’@StartDate’, ’Timestamp’),
xml_xpath(’@HourlyRate’, ’Integer’),
xml_xpath(’resume[1]/text()’ )
)
into EmpBenefits (BenefitId, EmpId, Amount, StartDate)
xml_row_pattern(’/insert/employee/benefits/benefit’)
values(xml_xpath(’@ID’, ’Integer’),
xml_xpath(’../../@ID’, ’Integer’),
xml_xpath(’@Amount’, ’Integer’),
xml_xpath(’@StartDate’, ’Timestamp’)
)
into Assignments (ProjId, EmpId, Task)
xml_row_pattern(’/insert/employee/projects/project/task’)
values(xml_xpath(’../@ID’, ’Integer’),
xml_xpath(’../../../@ID’, ’Integer’),
xml_xpath(’text()’)
)
Results:
Syntax
The syntax of a jXTransformer Update statement is as follows:
Syntax jxtr_update ::= update xml_document
((’reference_to_xml’ | ?)[, (ignore_whitespace | ?)] )
[xml_namespace ([’prefix’,] ’uri’)
{,xml_namespace ([’prefix’,] ’uri’)}]
{table_name xml_row_pattern(
(’row_pattern_expression’ | ? ))
{set jxtr_set_clause_list}
where jxtr_search_condition
}
where:
Update statement:
Update xml_document(’emp.xml’)
Employees xml_row_pattern(’/update/employee’)
set HourlyRate = xml_xpath(’@HourlyRate’,’Integer’)
where EmpId = xml_xpath(’@ID’,’Integer’)
Delete Statement
jXTransformer Delete statements delete rows from a relational
database table based on column values retrieved from an XML
document. When you define a jXTransformer Delete statement,
you specify:
1 The XML document from which to retrieve values that
identify the rows in the database table to delete. For
example:
delete xml_document(’emp.xml’)
2 The database table from which to delete rows. For example:
from Employees
3 The nodes of the XML document from which the values that
identify which rows to delete are retrieved. For example:
xml_row_pattern(’/update/employee’)
4 The database columns to use to identify the rows to delete
and the XML element or attribute of the nodes specified in
Step 3 from which to retrieve the value that identifies the
rows to delete. For example:
Syntax
The syntax of a jXTransformer Delete statement is as follows:
where:
Delete statement:
delete xml_document(?)
xml_namespace(’emp’,’http://www.jxtrdemo/delete’)
from Assignments
xml_row_pattern(’/root/emp:employee’)
where EmpId = xml_xpath(’@ID’,’Integer’)
from EmpBenefits
xml_row_pattern(’/root/emp:employee’)
where EmpId = xml_xpath(’@ID’,’Integer’)
from Employees
xml_row_pattern(’/root/emp:employee’)
where EmpId = xml_xpath(’@ID’,’Integer’)
Class Description
JXTRBase Implements methods that are
shared by the
JXTRResultSetWrapper, JXTRQuery,
JXTRSingleTableUpdate, and
JXTRUpdate classes. An abstract
class.
JXTRDatabaseExtension Implements methods that extend
database-specific processing. Use
this class only when you want to
override the default jXTransformer
behavior. An abstract class.
JXTRException Implements a Java exception
object, which is thrown if an
unexpected occurrence is
encountered during the processing
of a jXTransformer method.
Class Description
JXTRQuery Implements the methods required
to:
■ Transform the results from a
jXTransformer query into an
XML document in any of the
supported formats: DOM
level 2, JDOM, character stream,
or SAX2
■ Generate a DTD or schema
based on the jXTransformer
query that describes the XML
structure
Class Description
JXTRResultSetWrapper Implements the methods required
to execute a SQL99 query and
generate an element-centric or
attribute-centric XML result set.
This class wraps XML elements or
attributes around the row and
column data that is retrieved from
the database. Use this class when
you do not want to define the
hierarchical structure of an XML
document.
See “JXTRQuery and
JXTRResultSetWrapper Classes” on
page 152 for more information.
JXTRSaxInputSource Implements the methods that
extend the SAX2 InputSource
interface and is typically used with
a JXTRSaxReader object.
JXTRSaxReader Implements the methods required
to implement a SAX2 XMLReader
interface and is used with a
JXTRResultSetWrapper or
JXTRQuery object.
JXTRSingleTableUpdate Implements the methods required
to execute a SQL99 Insert, Update,
or Delete statement based on one
or multiple sets of parameter
marker values retrieved from an
input XML document.
See “JXTRUpdate and
JXTRSingleTableUpdate Classes”
on page 154 for more information.
Class Description
JXTRSingleTableUpdateException Implements a Java exception
object, which is thrown if an
unexpected occurrence is
encountered during the processing
of a SQL99 Insert, Update, or
Delete statement.
JXTRStatement Implements the methods required
to determine if a jXTransformer
statement is a jXTransformer query
statement or a jXTransformer
Insert, Update, or Delete
statement.
JXTRUpdate Implements the methods required
to:
■ Execute a jXTransformer Insert,
Update, or Delete statement
Task Method
Add document-level comments addDocumentComment
Add document-level processing instructions addDocumentPI
Add root attributes addRootAttribute
Add a namespace definition to a root addRootNamespace
element
Execute a query and return the XML as a executeDOM
DOM level 2 document object
Execute a query and create the XML executeDOM
document under the specified DOM level 2
node
Execute a query and return the XML as a executeJDOM
JDOM document
Execute a query and create the XML executeJDOM
document under the specified JDOM
element
Execute a query and invoke the SAX2 executeSAX
callbacks as registered with the specified
XML reader
Execute a query and write the XML as a executeWriter
character stream to the specified writer,
which uses either UTF-8 encoding or
encoding you specify
Task Method
Generate a DTD describing the structure of generateDTD
the query result and write the DTD on the
specified Writer object
Generate an XML schema describing the generateXMLSchema
structure of the query result and optionally
write the schema on the specified Writer
object
Set values for parameters setBigDecimal
setBoolean
setByte
setBytes
setInt
setObject
setString
setShort
setLong
setFloat
setDouble
setDate
setTime
setTimestamp
setNull
Set the root tag name for the resulting XML setRootTag
Set a private or public external DTD setExternalDTD
definition
JXTRUpdate and
JXTRSingleTableUpdate Classes
Table 6-3 lists some common tasks that you can perform using the
methods of the JXTRUpdate and JXTRSingleTableUpdate classes.
These classes are the most frequently used jXTransformer API
classes when you are working with jXTransformer write
statements.
JXTRUpdate Class
Task Method
Execute a jXTransformer Insert, executeUpdate
Update, or Delete statement and
return a row count
Read the input from an XML setDOM
document in the DOM level 2
format
Read the input from an XML setJDOM
document in the JDOM format
Read the input from an XML setReader
document in a character stream
format
Read the input from an XML setSAX
document in the SAX2 format
Task Method
Set values for parameters setBigDecimal
setBoolean
setByte
setBytes
setDate
setDouble
setFloat
setInt
setLong
setNull
setObject
setShort
setString
setTime
setTimestamp
Sets configuration options setBinaryEncoding
setNullReplacementValue
setTimestampEncoding
JXTRSingleTableUpdate Class
Task Method
Execute the SQL99 Insert, Update, executeUpdate
or Delete statement and return a
row count
Read the input from an XML setXMLDocument
document in one of the supported
formats: URL, DOM Level 2
document or node, JDOM
document or node, character
stream, SAX2
Set the XPath expression that will setXMLRowPattern
be used as the XML row pattern to
identify the data to be extracted
from the XML document
Set the XPath expressions used to setXMLXPath
extract the values from the XML
document
Set the namespace definitions setXMLNamespace
used in the XPath expressions
Task Method
Execute the SQL99 Insert, Update, executeUpdate
or Delete statement and return a
row count
Set values for parameters setBigDecimal
setBinaryEncoding
setBoolean
setByte
setBytes
setDate
setDouble
setFloat
setInt
setLong
setNull
setNullReplacementValue
setObject
setShort
setString
setTime
setTimestamp
setTimestampEncoding
import java.io.OutputStreamWriter;
import java.sql.*;
import com.ddtek.jxtr.*;
import Example;
/**
* Executes the 'Example1' example
*/
public void execute() throws Exception
{
// Output example description
System.out.println( "Example1 demonstrates:" );
System.out.println( " (a) Basic XML document fragment construction" );
System.out.println( " (b) Writer output to System.out" );
// Execute
OutputStreamWriter systemOutWriter = new OutputStreamWriter ( System.out );
boolean generateImplicitRoot=false;
jxtrQuery.executeWriter ( systemOutWriter, generateImplicitRoot,
systemOutWriter.getEncoding (), 2 );
// Execute
generateImplicitRoot=true;
jxtrQuery.executeWriter ( systemOutWriter, generateImplicitRoot,
systemOutWriter.getEncoding (), 2 );
/**
* Main method.
*/
public static void main ( String[] args ) throws Exception
{
Example thisDemo = new Example1();
thisDemo.execute();
}
}
* --------------------------------------------------------------------------
*/
import java.io.OutputStreamWriter;
import java.sql.*;
import com.ddtek.jxtr.*;
import Example;
/**
* Executes the 'Example9' example
*/
public void execute() throws Exception
{
// Output example description
System.out.println( "Example9 demonstrates:" );
System.out.println( " (a) Basic update of multiple database tables" );
System.out.println( " using values from a XML document." );
System.out.println( " (b) Use of query parameters to set XPath values
and 'normal' values." );
System.out.println( " (c) Write the number of updated rows to System.out." );
// Set parameters
jxtrUpdate.setTimestamp( 1, new java.sql.Timestamp
( System.currentTimeMillis() ) );
jxtrUpdate.setString ( 2, "../../@ID" );
jxtrUpdate.setString ( 3, "Integer" );
// Execute
int[][] updateCount = null;
try
{
updateCount = jxtrUpdate.executeUpdate();
} catch ( Exception ex )
{
System.out.println ( "!!! Insert failed !!!" );
if (ex instanceof JXTRUpdateException)
{
// Commit changes
conn.commit();
/**
* Main method.
*/
public static void main ( String[] args ) throws Exception
{
Example thisDemo = new Example9();
thisDemo.execute();
}
}
xml_document(
xml_comment('jxtr Example4 - Part 1'),
xml_external_dtd('example4.dtd'),
Specifies
document-level xml_pi('xml-stylesheet', 'type="text/xsl"
constructs href="file://example4.xsl"'),
xml_element('exns:example4',
xml_attribute('rootatt1','example4'),
xml_namespace('http://www.jxtrdemo/default'),
xml_namespace('exns','http://www.jxtrdemo/example4'),
select
xml_element('empinfo',
xml_attribute_key('exns:id',e.EmpId ),
Specifies data
to be retrieved
xml_attribute('exns:name',e.LastName),
and defines the (select
structure of xml_element('project',
the XML xml_attribute('name',p.Name),
document xml_attribute('task',a.Task))
from Projects p, Assignments a
where p.ProjId=a.ProjId and a.EmpId=e.EmpId) )
from Employees e where e.EmpId between ? and ?) )
select
xml_element('empinfo',
Parent xml_attribute_key('exns:id',e.EmpId ),
query xml_attribute('exns:name',e.LastName),
(select
Child
xml_element('project',
query xml_attribute('name',p.Name),
xml_attribute('task',a.Task))
from Projects p, Assignments a
where p.ProjId=a.ProjId and a.EmpId=e.EmpId))
from Employees e where e.EmpId between ? and ?
As you build the query in the example, you will construct the
parent query first. Then, you will construct the child query.
NOTE: Typically, you would construct the part of the query that
represents the structure of the XML document first, and then,
insert document-level constructs in the query. If you prefer,
however, you can insert document-level constructs first as
described in “Specifying Document-Level Constructs in the
jXTransformer Query” on page 187. Or, you can set the
document-level constructs in the jXTransformer API as shown in
“Coding the jXTransformer Query in a JDBC Application” on
page 200.
2 Type the following Base SQL Query for the parent query:
select
e.EmpId,
e.LastName
from Employees e where e.EmpId between ? and ?
The Base SQL Query accomplishes the following tasks:
■ Selects every column in the parent query containing the
data to retrieve
■ Specifies the tables from which to retrieve data
■ Optionally, specifies any filters on the Select statement
Notice that the Where clause in our example specifies a filter
on the Select statement of the parent query and contains
Now that you have defined which data to retrieve from the
database for the parent query, you can define the XML
structure, including the hierarchical relationships of the data.
select
xml_element('empinfo',
Parent xml_attribute_key('exns:id',e.EmpId ),
query xml_attribute('exns:name',e.LastName),
(select
Child
xml_element('project',
query xml_attribute('name',p.Name),
xml_attribute('task',a.Task))
from Projects p, Assignments a
where p.ProjId=a.ProjId and a.EmpId=e.EmpId))
from Employees e where e.EmpId between ? and ?
TIP: Because keys 7 Now, add an attribute key named exns:id that will retrieve
uniquely identify the employee ID from the database column e.EmpId. Because
rows in the this attribute key will be a child of the element named
database, we
recommend that
empinfo, right-click the ELEMENT node named empinfo.
you use keys when Select Insert / Attribute node / As Select Expression. The
possible to Attribute Node dialog box appears.
facilitate the
performance of
data retrieval.
Now, you have constructed the parent query and can construct
the nested child query as described in the next section.
2 Type the following Base SQL Query for the child query:
select
p.Name,
a.Task
from Projects p, Assignments a
where p.ProjId=a.ProjId and a.EmpId=e.EmpId
3 Click OK. The Builder checks the Base SQL Query for syntax.
The Base SQL Query node appears in the project tree.
Now that you have defined which data to retrieve from the
database for the child query, you can now define the XML
structure, including the hierarchical relationships of the data.
11 Next, add an attribute named task that retrieves the tasks the
employee worked on from the database column a.Task.
Because this attribute will be a child of the element named
project, right-click the ELEMENT node named project. Select
Insert / Attribute node / As Select Expression. The Attribute
Node dialog box appears.
You have completed the part of the query that specifies which
data will be retrieved and defines the XML structure of the
resulting XML document.
If you want to see what the jXTransformer query looks like using
the jXTransformer grammar, switch to Text view in the Builder by
selecting the Text View tab. If your jXTransformer query is
syntactically correct, the Builder allows you to switch from Tree
view to Text view or the reverse.
Adding a Comment
1 Next, add a comment to the document header. Select the
project node, and select Insert / Comment. The Comment
Node dialog box appears.
NOTE: To execute the query and return valid results, you must
have created the demo database tables as explained in the
README in the install_dir/jxtr/examples directory (where
install_dir is the jXTransformer installation directory).
In the first Value field, type 1 and in the second Value field,
type 5. Then, click OK.
The Execute Query window appears.
");
Also, notice that quotes in a Java string constant must be
preceded by the Java escape character \, for example:
JXTRQuery.setInt ( 1, 1 );
sets the value of the first parameter marker to 1, and:
JXTRQuery.setInt ( 2, 5 );
sets the value of the second parameter marker to 5.
TIP: You also can ■ Generates a DTD describing the resulting XML named
generate a DTD example4.dtd by calling the jXTransformer generateDTD
that describes the method of the JXTRQuery class.
resulting XML
using the ■ Sends the resulting XML document to System.out.
jXTransformer
Builder. ■ Closes the JDBC connection and declares the main method.
import java.io.OutputStreamWriter;
import java.sql.*;
import com.ddtek.jxtr.*;
import Example;
/**
* Executes the 'Example4' example
*/
public void execute() throws Exception
{
// Output example description
System.out.println( "Example4 demonstrates" );
System.out.println( " (a) Creating XML documents that contain
document-level processing instructions," );
System.out.println( " comments, namespaces, an external DTD
reference, and a root element with attributes." );
System.out.println( " (b) How to accomplish this through the
jXTransformer grammar" );
System.out.println( " (c) Using a parameter marker in a jXTransformer
query." );
System.out.println( " (d) Creating a DTD describing the XML that results
from executing the jXTransformer query." );
// Create dtd
java.io.FileWriter dtdFile = new java.io.FileWriter ( "example4.dtd" );
JXTRQuery.generateDTD ( dtdFile );
dtdFile.close();
System.out.println( "------------" );
// Execute
OutputStreamWriter systemOutWriter = new OutputStreamWriter ( System.out );
boolean outputDocHeader = true;
JXTRQuery.executeWriter ( systemOutWriter, outputDocHeader,
systemOutWriter.getEncoding ( ), 2 );
/**
* Main method.
*/
public static void main ( String[] args ) throws Exception
{
Example thisDemo = new Example4();
thisDemo.execute();
}
jxtrQ.append ( "
and ends with
");
■ Constructs a new jXTransformer query object named
JXTRQuery based on the specified JDBC connection,
jXTransformer query, and rewrite algorithm.
■ Specifies the document-level constructs through the
jXTransformer API by calling the following methods:
• addDocumentComment adds the XML comment
<!--jxtr Example5--> in the document header.
JXTRQuery.setInt ( 2, 10 );
sets the value of the second parameter marker to 10.
■ Sends the resulting XML document to System.out.
■ Closes the JDBC connection and declares the main method.
import java.io.OutputStreamWriter;
import java.sql.*;
import com.ddtek.jxtr.*;
import Example;
/**
* Executes the 'Example5' example
*/
public void execute() throws Exception
{
// Output example description
System.out.println( "Example5 demonstrates" );
System.out.println( " (a) Creating XML documents that contain
document-level processing instructions," );
System.out.println( " comments, namespaces, an external DTD
reference, and a root element with attributes." );
System.out.println( " (b) How to accomplish this through the
jXTransformer API" );
System.out.println( " (c) Using a parameter marker in a jXTransformer
query." );
/**
* Main method.
*/
public static void main ( String[] args ) throws Exception
{
Example thisDemo = new Example5();
thisDemo.execute();
}
B jXTransformer Statement
Processing
Glossary
DTD (Document The statement of rules for an XML document that specify which XML
Type Definition) elements and attributes are allowed in the document.
DOM (Document A specification for how objects in XML are represented. The DOM
Object Model) defines what attributes are associated with each XML object, and how
the objects and attributes can be manipulated.
JAXP A Java API that supports processing of XML documents using DOM,
SAX, and XSLT.
jXTransformer A GUI tool that helps you create and modify jXTransformer queries
Builder without having to know the syntax of the jXTransformer grammar. You
can also use the jXTransformer Builder to check the syntax and
semantics of your jXTransformer query before you use it in your JDBC
applications. The jXTransformer Builder does not support
jXTransformer Insert, Update, and Delete statements.
jXTransformer A file with the extension .jxb that can be opened and saved by the
Builder project jXTransformer Builder. One or multiple jXTransformer queries
comprises a jXTransformer Builder project.
mixed content Content for an XML element that is mixed, that is, contains character
data or character data with child elements.
namespace A unique identifier that is used to group a set of XML names (elements
or attributes).
root element In XML, the element that is the single top-level tag. In jXTransformer, if
you omit the root element, an XML document fragment is created
instead of a complete XML document.
SAX The Simple API for XML is a standard interface for event-based XML
parsing.
schema A pattern that defines the elements, their attributes, and the
relationships between different elements.
URI (Uniform A character string that identifies the type and location of an Internet
Resource resource.
Identifier)
XML element A section of an XML document that is defined by start- and end-tags.
XPath A language that describes a way to locate and process items in XML
documents by using an addressing syntax based on a path through the
document's logical structure or hierarchy.
Index
A E
attribute-centric XML documents 39 element-centric XML documents 39
example
query 19
query in a JDBC application 159
C write statements 24
write statements in a JDBC application 162
choosing executing
rewrite algorithms 42 queries 127
XML write statements 145
document structure for queries 39
input format for write statements 45
output format for queries 41
contacting Technical Support 14 F
conventions used in this book 11
creating features, jXTransformer 17
complete XML documents 36 For XML Explicit Select statement 42
hierarchical XML documents 29
ID/IDREFS links 34
XML document fragments 36
customizing the Builder 56 G
generating
DTDs and XML schemas from queries 38
D XML from SQL99 queries 39
glossary 213
data types, JDBC to XML 209
DOM 18, 41, 45
DTDs, generating from queries 38
H
handling of JDBC preparedStatement
objects 211
hiding data in queries 33
R queries
in JDBC applications 22
tutorial 167
Reader object 45 Tree and Text views of the Builder 48
reader/writer object interfaces 18 write statements in JDBC applications 27
rewrite algorithms 91
for XML explicit 42
nested loop 42
outer union 42
sorted outer union 42
W
working with
Builder 48
S Builder project tree nodes 53
Writer object 41