Using HTMLDocument to create HTML data

An HTMLDocument functions as a wrapper that holds the information necessary to create either HTML or Extensible Stylesheet Language (XSL) Formatting Object (FO) source data. When you want to create HTML pages, the HTMLDocument class offers you an easier way to group all the required HTML tags.

Generating HTML source data

When creating HTML source, HTMLDocument retrieves HTML tags from the HTML objects you have created. You can use either HTMLDocument.getTag() to stream all the elements you have defined or the getTag() for each individual HTML object.

HTMLDocument generates HTML data as you define it in your Java™ program, so be sure that the resulting HTML is complete and correct.

When you call HTMLDocument.getTag(), the HTMLDocument object performs the following actions:

Note: HTMLDocument streams the HTML tags as your Java program directs, so make sure that you call the tags in the proper order.

Examples: Using HTMLDocument

The following example shows how to use HTMLDocument to generate HTML source data (and XSL FO source):

Example: Using HTMLDocument to generate both HTML source and XSL FO source

Javadoc reference documentation

For more information about the HTMLDocument class, see the following Javadoc reference documentation:

HTMLDocument

The following disclaimer applies to all of the IBM® Toolbox for Java examples:

Code example disclaimer

IBM grants you a nonexclusive copyright license to use all programming code examples from which you can generate similar function tailored to your own specific needs.

All sample code is provided by IBM for illustrative purposes only. These examples have not been thoroughly tested under all conditions. IBM, therefore, cannot guarantee or imply reliability, serviceability, or function of these programs.

All programs contained herein are provided to you "AS IS" without any warranties of any kind. The implied warranties of non-infringement, merchantability and fitness for a particular purpose are expressly disclaimed.