Skip Headers

Oracle9i XML Reference
Release 1 (9.0.1)

Part Number A88899-01
Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Go to previous page Go to next page

2
Package oracle.xml.classgen


CGDocument

Syntax

public abstract class CGDocument extends oracle.xml.classgen.CGNode
 
java.lang.Object
  |
  +--oracle.xml.classgen.CGNode
        |
        +--oracle.xml.classgen.CGDocument

Description

Serves as the base document class for the DTD compiler generated classes

Constructors

CGDocument()

protected  CGDocument()

CGDocument(String, DTD)

protected  CGDocument(java.lang.String doctype, oracle.xml.parser.v2.DTD dtd)

Constructor for the Root element of the DTD

Parameters:

doctype - Name of the root Element of the DTD

dtd - The DTD used to generate the classes

Methods

print(OutputStream)

protected void print(java.io.OutputStream out)

Prints the constructed XML Document

Parameters:

out - Output stream to which the document will be printed

Throws:

InvalidContentException - Throw exception if the document's content do not match the grammer specified by DTD (The validation mode should be set to TRUE)

See Also:

oracle.xml.classgen.ClassGenerator

print(OutputStream, String)

protected void print(java.io.OutputStream out, java.lang.String enc)

Prints the constructed XML Document

Parameters:

out - Output stream to which the document will be printed

enc - Encoding of the output stream

Throws:

InvalidContentException - Throw exception if the document's content do not match the grammer specified by DTD (The validation mode should be set to TRUE)

See Also:

oracle.xml.classgen.ClassGenerator


CGNode

Syntax

public abstract class CGNode extends java.lang.Object
 
java.lang.Object
  |
  +--oracle.xml.classgen.CGNode

Direct Known Subclasses:

CGDocument

Description

Serves as the base class for nodes generated by the DTD compiler

Fields

isValidating

protected boolean isValidating

Boolean to indicate the validating mode

Constructors

CGNode()

a protected CGNode()

CGNode(String)

protected  CGNode(java.lang.String elementName)

Constructor for the Elements of the DOM Tree

Parameters:

elementName - Name of the element

Methods

addCDATASection(String)

protected void addCDATASection(java.lang.String theData)

Adds CDATA Section to the Element

Parameters:

theData - Text to be added as CDATA Section to the element

Throws:

InvalidContentException - Thrown if theData has illegal characters (validation must be set to TRUE)

See Also:

oracle.xml.classgen.ClassGenerator

addData(String)

protected void addData(java.lang.String theData)

Adds PCDATA to the Element

Parameters:

theData - Text to be added to the element

Throws:

InvalidContentException - Thrown if theData has illegal characters (validation must be set to TRUE)

See Also:

oracle.xml.classgen.ClassGenerator

addNode(CGNode)

protected void addNode(CGNode theNode)

Adds a node as a child to the element

Parameters:

theNode - The node to be added as child

Throws:

InvalidContentException - Thrown if the Node cannot be added as child as per Content Model of the element (validation must be set to TRUE)

See Also:

oracle.xml.classgen.ClassGenerator

getCGDocument()

protected CGDocument getCGDocument()

Gets the base document (root Element)

Returns:

The base CGDocument

getDTDNode()

protected abstract oracle.xml.parser.v2.DTD getDTDNode()

Gets the static DTD from the base document

Returns:

DTD stored in base CGDocument

setAttribute(String, String)

protected void setAttribute(java.lang.String attName, java.lang.String value)

Sets the value of the Attribute

Parameters:

attName - Name of the attribute

value - Value of the attribute

setDocument(CGDocument)

public void setDocument(CGDocument d)

Sets the base document (root Element)

Parameters:

d - Base CGDocument

storeID(String, String)

protected void storeID(java.lang.String attName, java.lang.String id)

Store this value for an ID identifier, so that we can later verify IDREF values

Parameters:

attName - Name of the ID Attribute

id - Value of the ID

storeIDREF(String, String)

protected void storeIDREF(java.lang.String attName, java.lang.String idref)

Store this value for an IDREF identifier, so that we can later verify, if an corresponding ID was defined.

Parameters:

attName - Name of the IDREF Attribute

idref - Value of the IDREF

validateContent()

protected void validateContent()

Checks if the content of the element is valid as per the Content Model specified in DTD

Returns:

True if content is valid, else false

validEntity(String)

protected boolean validEntity(java.lang.String entity)

Checks if the ENTITY identifier is valid

Parameters:

name - value of the Entity Attribute

Returns:

True if Entity is valid, else false

validID(String)

protected boolean validID(java.lang.String name)

Checks if the ID identifier is valid

Parameters:

name - value of the ID Attribute

Returns:

True if ID is valid, else false

validNMTOKEN(String)

protected boolean validNMTOKEN(java.lang.String name)

Checks if the NMTOKEN identifier is valid

Parameters:

name - value of the Nmtoken Attribute

Returns:

True if Nmtoken is valid, else false


CGXSDElement

Syntax

public abstract class CGXSDElement
 
oracle.xml.classgen.CGXSDElement

Description

This class serves as the base class for the all the generated classes corresponding to the XML Schema generated by Schema Class Generator

Fields

type

protected java.lang.Object type

Constructors

CGXSDElement()

public  CGXSDElement()

Methods

addAttribute(String, String)

protected void addAttribute(java.lang.String attName, java.lang.String attValue)

Add the attribute of a given node to the hashtable.

Parameters:

attName - the attribute name

attValue - the attribute value

addElement(Object)

protected void addElement(java.lang.Object elem)

Add the elements of a given element node to the vector correspondig to the elements.

Parameters:

elem - the object which needs to be added

getAttributes()

public java.util.Hashtable getAttributes()

Return the attributes

Returns:

attributes the hashtable containing attribute name and value

getChildElements()

public java.util.Vector getChildElements()

Get the vector having all the local elements

Returns:

elemChild vector

getNodeValue()

public java.lang.String getNodeValue()

Return the node value

getType()

public java.lang.Object getType()

Return the type

print(XMLOutputStream)

public void print(oracle.xml.parser.v2.XMLOutputStream out)

Print an element node

Parameters:

out - the stream where the output is printed

printAttributes(XMLOutputStream, String)

public void printAttributes(oracle.xml.parser.v2.XMLOutputStream out, 
java.lang.String name)

Print an attribute node

Parameters:

out - the stream where the output is printed

name - the attribute name

setNodeValue(String)

protected void setNodeValue(java.lang.String value)

Set the node value of an element

Parameters:

value - the node value


DTDClassGenerator

Syntax

public class DTDClassGenerator extends java.lang.Object
 
java.lang.Object
  |
  +--oracle.xml.classgen.DTDClassGenerator

Description

This class is used by the DTD compiler to generate classes

Constructors

DTDClassGenerator()

public  DTDClassGenerator()

Default constructor for DTDClassGenerator.

Methods

generate(DTD, String)

public void generate(oracle.xml.parser.v2.DTD dtd, java.lang.String doctype)

Traverses the DTD with element doctype as root and generates Java classes

Parameters:

DTD - The DTD used to generate the classes

doctype - Name of the root Element

printDocumentMethods()

protected void printDocumentMethods()

setGenerateComments(boolean)

public void setGenerateComments(boolean comments)

Switch to determine whether to generate java doc comments Default - TRUE

Parameters:

comments - boolean flag

setJavaPackage(Vector)

public void setJavaPackage(java.util.Vector packageName)

Sets the package for the classes generated Default - No package

Parameters:

packageName - Name of the package

setOutputDirectory(String)

public void setOutputDirectory(java.lang.String dir)

Sets the output directory where the java source code for the DTD are generated. Default - current directory

Parameters:

dir - Output directory

setSerializationMode(boolean)

public void setSerializationMode(boolean yes)

Switch to determine if the DTD should be saved as a serialized object or as text file. Serializing the DTD improves the performance when the generated classes are used to author XML files. Default - FALSE (DTD is saved a text file)

Parameters:

yes - boolean flag

setValidationMode(boolean)

public void setValidationMode(boolean yes)

Switch to determine whether the classes generated should validate the XML Document being constructed Default - TRUE

Parameters:

yes - boolean flag


InvalidContentException

Syntax

public class InvalidContentException extends java.lang.Exception
 
java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--oracle.xml.classgen.InvalidContentException

All Implemented Interfaces:

java.io.Serializable

Description

Definition of InvalidContentException thrown by dtdcompiler classes

Constructors

InvalidContentException()

public  InvalidContentException()

InvalidContentException(String)

public  InvalidContentException(java.lang.String s)

oracg

Syntax

public class oracg extends java.lang.Object
 
java.lang.Object
  |
  +--oracle.xml.classgen.oracg

Description

The oracg class provides a command-line interface to generate java classes corresponding to the DTD or XML Schema java oracle.xml.classgen.oracg options are: -h Prints the help message text -d The input file is a DTD file or DTD based XML file -s The input file is a Schema file or Schema based XML file -o The directory name where java source is generated -p The package name(s) of the generated java classes. -c Generate comments for the generated java source code.

Constructors

oracg()

public  oracg()

Default constructor for oracg

Methods

main(String[])

public static void main(java.lang.String[] args)

The main method


SchemaClassGenerator

Syntax

public class SchemaClassGenerator extends java.lang.Object
 
java.lang.Object
  |
  +--oracle.xml.classgen.SchemaClassGenerator

Description

This class generates the classes corresponding to an XML Schema.

Constructors

SchemaClassGenerator()

public  SchemaClassGenerator()

Default empty constructor for Schema Class Generator

SchemaClassGenerator(String)

public  SchemaClassGenerator(java.lang.String fileName)

The constructor for Schema Class Generator

Parameters:

fileName - the input XML Schema

Methods

generate(XMLSchema)

public void generate(oracle.xml.parser.schema.XMLSchema schema)

Generate the Schema classes corresponding to top level elements, simpleType elements and complexType elements by calling createSchemaClass on each of these nodes.

Parameters:

XML - Schema object

Throws:

setGenerateComments(boolean)

public void setGenerateComments(boolean comments)

Switch to determine whether to generate java doc comments The default setting is true

Parameters:

comments - boolean flag

setJavaPackage(XMLSchema, Vector)

public void setJavaPackage(oracle.xml.parser.schema.XMLSchema schema, 
java.util.Vector pkgName)

Sets the Java package names corresponding to Namespaces. The Namespaces defined in the schema are queried. The Number of namespaces defined in the schema should match the number of package names given by the user through command line else an error is thrown. For each namespace, a user-defined package name is assigned.

Parameters:

schema - XMLSchema

pkgName - A vector containing user defined pacake names given through command line.

setOutputDirectory(String)

public void setOutputDirectory(java.lang.String dir)

Sets the output directory where the java source code for the Schema class are generated. Default - current directory

Parameters:

dir - Output directory


Go to previous page Go to next page
Oracle
Copyright © 1996-2001, Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index