Oracle8i Application Developer's Guide - XML Release 3 (8.1.7) Part Number A86030-01 |
Library | Service | Contents | Index

Using XML Java Class Generator, 3 of 8

## Using XML Class Generator for Java

The XML Class Generator for Java creates Java source files from an XML DTD. This is useful for the following situations:

- When an application wants to send an XML message to another application based on an agreed-upon DTD

- As the back end of a web form to construct an XML document.

Using the Class Generator classes, Java applications can construct, validate, and print XML documents that comply with the input DTD.

It also optionally generates Javadoc comments in the source files. XML Class Generator requires Oracle XML Parser for Java.

Figure 18-1 shows a summary of how XML Java Class Generator is used.

#### Figure 18-1 XML Java Class Generator

XML Java Class Generator works in conjunction with XML Parser for Java, which parses the DTD and passes the parsed document to the Class Generator.

See Also: Figure 3-8, "Using Oracle XML Components to G enerate an XML Document - C Options" in Chapter 3, "Oracle XML Components and General FAQs".

Figure 18-2 shows the XML Java Class Generator usage.

XML Java Class Generator operates as follows:

1. A new ClassGenerator() class is initiated and inputs the generate() method. Available properties for ClassGenerator() class are:

   - setGeneraterComments(), with default = TRUE

   - setJavaPackage(string), with default = no package

   - setOutputDirectory (string), with default = current directory

2. If a DTD is used, the DTD object returned using getDocType() from the parseDTD() method, is also input. See also Figure 17-4, "XML Parser for Java: DOMParser()" from Chapter 17, "Using XML Parser for Java".

3. The generate() method generates Java classes which can then be used to build your XML document.

   See Also: Appendix C, "XDK for Java: Specifications and Cheat Sheets" Oracle8i XML Reference Chapter 3, "Oracle XML Components and General FAQs", "Using Oracle XML Components to Generate XML Documents: Java"

#### Figure 18-2 XML Java Class Generator Usage

| Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
Library | Service | Contents | Index