|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.openxml.DOMFactory
Factory for XML, HTML and DTD documents, parsers and printers. The factory
has methods for creating new documents, parsers and printers. The exact
type is determined by the document class, this might be Document
(DOCUMENT_XML
), HTMLDocument
(DOCUMENT_HTML
),
DocumentType
(DOCUMENT_DTD
) or a user document derived from
XMLDocument
.
The default document type is controlled by the openxml.document.class propety in the OpenXML properties file ( openxml.prop). The parser and printer classes for XML, HTML and DTD documents are also controlled by the property file.
The method createDocument(java.lang.Class)
does not guarantee that it will return
Document
, although this is the default behavior. To obtain a
Document
either pass its class as argument, or call createXMLDocument()
.
A newly created parser is only guaranteed to extend Parser
, even
if DOCUMENT_XML
has been specified as the document type. To create
a document from a user class, either use Source
, or the following
code:
Parser parser; parser = DOMFactory.createParser( reader, sourceURI, docClass ); if ( parser instanceof XMLParser ) doc = ( (XMLParser) parser ).parseDocument( null, docClass ); else doc = parser.parseDocument();
Document
,
XMLElement
,
XMLCollection
Field Summary | |
static java.lang.Class |
DOCUMENT_DTD
DTD document class. |
static java.lang.Class |
DOCUMENT_HTML
HTML document class. |
static java.lang.Class |
DOCUMENT_XML
XML document class. |
Constructor Summary | |
DOMFactory()
|
Method Summary | |
static Document |
createDocument(java.lang.Class docClass)
Creates and returns a new XML/HTML/DTD document. |
static DTDDocument |
createDTDDocument()
Creates and returns a new DTD document. |
static HTMLDocument |
createHTMLDocument()
Creates and returns a new HTML document. |
static org.openxml.io.Parser |
createParser(java.io.InputStream stream,
java.lang.String sourceName)
Creates and returns a new XML parser. |
static org.openxml.io.Parser |
createParser(java.io.InputStream stream,
java.lang.String sourceName,
java.lang.Class docClass)
Creates and returns a new XML/HTML/DTD parser. |
static org.openxml.io.Parser |
createParser(java.io.Reader reader,
java.lang.String sourceName)
Creates and returns a new XML parser. |
static org.openxml.io.Parser |
createParser(java.io.Reader reader,
java.lang.String sourceURI,
java.lang.Class docClass)
Creates and returns a new XML/HTML/DTD parser. |
static org.openxml.io.Printer |
createPrinter(java.io.OutputStream stream,
int mode)
Deprecated. This method has become obsolete in favor of the X3P Publisher and Producer APIs. This method is temporarily provided for backward compatibility but will not be included in release 1.1. |
static org.openxml.io.Printer |
createPrinter(java.io.OutputStream stream,
int mode,
java.lang.Class docClass)
Deprecated. This method has become obsolete in favor of the X3P Publisher and Producer APIs. This method is temporarily provided for backward compatibility but will not be included in release 1.1. |
static org.openxml.io.Printer |
createPrinter(java.io.Writer writer,
int mode)
Deprecated. This method has become obsolete in favor of the X3P Publisher and Producer APIs. This method is temporarily provided for backward compatibility but will not be included in release 1.1. |
static org.openxml.io.Printer |
createPrinter(java.io.Writer writer,
int mode,
java.lang.Class docClass)
Deprecated. This method has become obsolete in favor of the X3P Publisher and Producer APIs. This method is temporarily provided for backward compatibility but will not be included in release 1.1. |
static Document |
createXMLDocument()
Creates and returns a new XML document. |
static java.lang.Class |
getDocClass(java.lang.Class docClass)
Returns the specified document class, or the properties file specified class, or the default. |
static HolderFinder |
getHolderFinder()
Returns a singleton holder finder. |
static java.util.Properties |
getProperties()
Returns the properties list from the OpenXML properties file. |
static java.lang.String |
getProperty(java.lang.String name)
Returns the property from the OpenXML properties file. |
static Source |
newSource()
|
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final java.lang.Class DOCUMENT_XML
Document
.public static final java.lang.Class DOCUMENT_HTML
HTMLDocument
.public static final java.lang.Class DOCUMENT_DTD
DTDDocument
.Constructor Detail |
public DOMFactory()
Method Detail |
public static Document createXMLDocument()
Document
.Document
public static HTMLDocument createHTMLDocument()
HTMLDocument
.HTMLDocument
public static DTDDocument createDTDDocument()
DTDDocument
.DTDDocument
public static Document createDocument(java.lang.Class docClass)
Document
is used.
Note that the returned document type may or may not be Document
,
but it must extend Document
, and that is also true for non-XML
documents.
Document
public static org.openxml.io.Parser createParser(java.io.Reader reader, java.lang.String sourceURI, java.lang.Class docClass)
createDocument(java.lang.Class)
apply here.
The parser is only guaranteed to extend Parser
and will use
createDocument(java.lang.Class)
to create an instance of the parsed document.
To create a document of a user class, either use Source
, or
the following code:
Parser parser; parser = DOMFactory.createParser( reader, sourceURI, docClass ); if ( parser instanceof XMLParser ) doc = ( (XMLParser) parser ).parseDocument( null, docClass ); else doc = parser.parseDocument();
reader
- A reader to the document sourcesourceURI
- The source URIdocClass
- The requested document typepublic static org.openxml.io.Parser createParser(java.io.Reader reader, java.lang.String sourceName) throws java.io.IOException
reader
- A reader to the document sourcesourceURI
- The source URIpublic static org.openxml.io.Parser createParser(java.io.InputStream stream, java.lang.String sourceName, java.lang.Class docClass) throws java.io.IOException
createDocument(java.lang.Class)
apply here.
The parser is only guaranteed to extend Parser
and will use
createDocument(java.lang.Class)
to create an instance of the parsed document.
To create a document of a user class, either use Source
, or
the following code:
Parser parser; parser = DOMFactory.createParser( reader, sourceURI, docClass ); if ( parser instanceof XMLParser ) doc = ( (XMLParser) parser ).parseDocument( null, docClass ); else doc = parser.parseDocument();
input
- An input stream to the document sourcesourceURI
- The source URIdocClass
- The requested document typepublic static org.openxml.io.Parser createParser(java.io.InputStream stream, java.lang.String sourceName) throws java.io.IOException
input
- An input stream to the document sourcesourceURI
- The source URIpublic static org.openxml.io.Printer createPrinter(java.io.Writer writer, int mode, java.lang.Class docClass) throws java.io.IOException
createDocument(java.lang.Class)
apply here.writer
- A writer for the document outputmode
- The printing modedocClass
- The document typepublic static org.openxml.io.Printer createPrinter(java.io.Writer writer, int mode) throws java.io.IOException
writer
- A writer for the document outputmode
- The printing modepublic static org.openxml.io.Printer createPrinter(java.io.OutputStream stream, int mode, java.lang.Class docClass) throws java.io.IOException
createDocument(java.lang.Class)
apply here.output
- A stream for the document outputmode
- The printing modedocClass
- The document typepublic static org.openxml.io.Printer createPrinter(java.io.OutputStream stream, int mode) throws java.io.IOException
output
- A stream for the document outputmode
- The printing modepublic static java.lang.String getProperty(java.lang.String name)
name
- The property namepublic static java.util.Properties getProperties()
public static java.lang.Class getDocClass(java.lang.Class docClass)
Document
) is used.docClass
- The specified document class, or nullDocument
public static Source newSource()
public static HolderFinder getHolderFinder()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |