xmlc
- Compiles XML or HTML files into Java classes.
xmlc [options] [optfile.xmlc ...] docfile
Compile a XML or HTML document into a class that can be used to generate a dynamically alter version of the document. An instance of the class is a DOM object heirarchy representation of the orginal document. The DOM document can then be dynamically modified in Java to add content or otherwise alter the document. Access methods, based on XML/HTML, identifiers are generated to allow for compile-time consistency checking between the document and an user of the generated class. A textual repesentation of the modified document can then be created from the DOM object. For details, see:
Various options controlling the behavior of the compiler maybe specified on
the command line or in or or more
options files, identified by the
.xmlc
extension.
The document file (docfile
) is examine to determine
if its an XML or HTML file. XML files must start with an XML prolog declaration
(<?xml ...>).
The options for xmlc
are:
-class classname
-
Fully qualified name for the generated class or interface. The directory
under which the class is written is determined by the -d
option.
-keep
-
Keep the generate Java source, do not delete it.
-sourceout sourceout
-
Specifies the root directory for generated source files.
If -keep
is specified, the generate source files will be
saved under this directory.
-nocompile
-
If specified, don't compile the generate Java file. Useful with
the -keep
option or the various information reporting
options.
-implements interface
- Specifies that the
generate class will implement interface
.
This option maybe specified multiple times.
-urlmapping orgURL newURL
-
Specify a URL to in tag attributes that are specified to contain a URL or script
All occurances of orgURL
will be changed to
newURL
in these attributes.
This option maybe specified multiple times.
-urlregexpmapping regexp subst
-
Specify a regular expression to match against URL tag attributes that are
specified to contain a URL or script. If the regular expression matches,
if is substituted using regexp subst
. POSIX
extended regular expressions are used.
This option uses the gnu.regexp
package. Set the
documentation on this package for details of the regular expression and
substitution syntax. This option maybe specified multiple times.
-urlsetting id newURL
-
Specify a URL to modify in the DOM by tag id. The URL in the tag with
the id id
will be changed to
newURL
.
This option maybe specified multiple times.
-info
-
Print useful information about the page object, such as ids and
URLs.
-dump
- Dump out the DOM tree for the page.
-verbose
-
Generate useful output about the compiler process. This flag is
also passed to javac
.
-parseinfo
-
Print detailed information about the page parsing.
-methods
-
Print the signature of each generated access method.
This also lists the methods and access constants that
were not generated due to being invalid Java identifiers.
-javac prog
-
Specify the Java compiler to use. Several commonly use
javac
options maybe
specified directly, other options are specified with the
-javacflag
or -javacopt
options
-javacflag flag
-
Aribitrary flag to pass to the javac
program. This options maybe
specified multiple times. The flag
argument
should contain the leading `-' or `+' characters. This is used
to for javac
options that don't take values.
-javacopt opt value
-
Aribitrary option and value to pass to the javac
program.
This option maybe specified multiple times. The opt
argument
should contain the leading `-' or `+' characters.
-docout file
- Write a static document to
file
instead of generating and compiling Java
code. This is useful for pages where the URL's must be mapped to
reference dynamic pages, but there is no other dynamic content.
-version
-
Print the XMLC version number. If no other arguments are specified, exit.
The docfile
is not required if this options is
specified.
-parser parser
- Specifies the parser to
use when parsing a file. The following values are valid:
tidy
- Use the Tidy parser for parsing HTML. This
is the default for HTML. Validation is always done by this parser.
swing
- Use the Swing parser for parsing HTML.
Validation is always done by this parser.
xerces
- Use the Xerces parser for parsing XML.
This is only XML parser and is the default
Validation is optional with this parser.
The default is to validate.
-xcatalog catalog
- Specifies a XCatalog
file to use in resolving external entities when parsing XML files.
This option maybe specified multiple times. The catalogs will be
search in the order specified.
-validate yes|no
- Changes the default document validation mode
of the parser. An error is generated if the value isn't supported by the
parser.
-delete-class classname
- Delete all elements
that are in the class classname
. This is
the element class, as specified by the HTML class
attribute,
not a Java class. This is useful for removing mockup data.
This option maybe specified multiple times.
-generate type
- Indicate what type of class
to generate. Standalone class or interfaces and implementing
classes can be generated.
both
- Generate both an interface and an implementation.
The implementation will have the string "Impl" appended to the
class name defined with -class
.
interface
- Generate just the interface.
implementation
- Generate just the class that
implements the interface, but not the interface.
class
- Generate a class that does not depend on an
interface. This is the default.
-for-recomp
- Generate support for automatic recompilation
of the generated class. A file classname.xmlc
in the same directory as the generate and compiled class. This file
contains the options necessary for automatically recompilation of
the class.
This option implies -generate both
.
-recomp-source filepath
- Specifies the relative
path of the source file that the recompilation factory will use.
If not specified, the file path is generated by converting
the package name into a file path and merging with the base name
of the source file.
-domfactory classname
- Specify the Java class for
creating DOM documents. This class must implement
org.enhydra.xml.xmlc.dom.XMLCDomFactory
.
The option is not supported for HTML documents.
The DOM factory must have a constructor that takes no arguments.
This class serves as a factory for Document
objects,
giving a mechanism for creating DTD-specific DOMs.
Element
classes that correspond to a specific element types.
The specified class must be available on the CLASSPATH
environment variable.
-extends classname
- Specify the class that the
generated class will extend. This class must extend
XMLObjectImpl
for XML documents or HTMLObjectImpl
for HTML documents. Normally, the class is abstract.
The specified class must be available on the CLASSPATH
environment variable.
-html:encoding encoding
- Specify the encoding
to use when reading a HTML document. The encoding name is an
HTML encoding name, not a Java encoding name.
-html:addtagset tagsetname
- Add a predefined
set of proprietary tags to the list of valid HTML tags. The tag
sets currently defined are:
cyberstudio
- Tags added by Adobe CyberStudio.
These tags are for its own use and assumed to be ignored by
browsers.
tidy
parser.
Contributions of new tag set defintions would be appreciated.
-html:addtag tagname flags
- Add a proprietary tag to
the list of valid HTML tags. Option is used to inform the tidy
parser that this tag is valid. The tagname
is
case insensitive. The flags
is a comma-seperated
list containing the content model and other options describing the
tag. The following case-insensitive values are valid:
inline
- Character level elements.
block
- block-like elements e.g. paragraphs and lists.
empty
- Tag does not have a closing tag.
opt
- Closing tag is optional.
inline
, block
, or
empty
must be specified.
This option is only used by the tidy
parser.
-html:addattr attrname
- Add a proprietary attribute
the list of valid HTML attributes. The attribute will be allowed on
all tags.
This option is only used by the tidy
parser.
-html:old-class-constants
- Older versions of
XMLC generated HTML class attribute constants as all upper-case
(CLASS_DELETEROW
) with values being case-preserved.
Specifying this option will reproduce the old behavior. This option is
intended to aid in the porting of existing applications; it may not be
support in future releases.
-html:old-name-constants
- Older versions of
XMLC generated HTML name attribute constants as all upper-case
(NAME_INPUT
) with values being case-preserved.
Specifying this option will reproduce the old behavior. This option is
intended to aid in the porting of existing applications; it may not be
support in future releases.
javac
are:
-g
-O
-debug
-verbose
-classpath path
-d dir