Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.document
Class DocumentFactory

    java.lang.Object
      com.bea.document.DocumentFactory

public class DocumentFactory
extends Object

Default factory for creating instances of IDocument.

Constructor Summary
`DocumentFactory()`

Method Summary
`static IDocument` | `createDocument()` Create a blank document.
`static IDocument` | `createDocument(Document document)` Create a document using the given DOM document.
`static IDocument` | `createDocument(Element documentRootElement)` Create a document using a copy of the given Element as the document root element.
`static IDocument` | `createDocument(File file)` Create a document by reading XML text previously saved to a file.
`static IDocument` | `createDocument(File file, String encoding)` Create a document by reading XML text previously saved to a file.
`static IDocument` | `createDocument(IDocument document)` Create a new document that is a deep copy of the given document.
`static IDocument` | `createDocument(InputSource inputSource)` Create a document by reading the XML text for the document from the given InputSource.
`static IDocument` | `createDocument(Reader reader)` Create a document by reading the XML text for the document from the given Reader.
`static IDocument` | `createDocument(String xml)` Create a document using the given XML text.
`static IDocument` | `createDocument(String xml, boolean deferParse)` Create a document using the given XML text, optionally deferring the parse of that XML until a later time.
`static IDocumentDefinition` | `createDocumentDefinition()` Create a document definition instance.
`static IDocumentDefinition` | `createDocumentDefinition(String documentTypeName)` Create a document definition with the given document type name.
`static IDocumentDefinition` | `createNullDocumentDefinition()` Create a document definition for an empty/null document type.
`static String` | `generateNamespacePrefix(String namespaceURI)` Generate a namespace prefix based on the given namespace URI.
`static String` | `serializeElement(Element elem)` Serialize the given Element out as XML and return a String.
`static void` | `serializeElement(Writer writer, Element elem)` Serialize the given Element as XML out to the given Writer.
`static void` | `serializeElement(Writer writer, int indent, int indentSize, Element elem)` Serialize the given Element as XML out to the given Writer, using the given indent level and indentSize.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DocumentFactory

    public DocumentFactory()

Method Detail

### createDocument

    public static IDocument createDocument()

  Create a blank document.

### createDocument

    public static IDocument createDocument(String xml)
                                    throws DocumentParseException,
                                           DocumentException

  Create a document using the given XML text. This is equivalent to calling createDocument(String, true) and defers the parse of the XML text until the time it is first accessed in a way requiring a parsed DOM (e.g. IDocument.getStringFrom(), IDocument.setStringIn(), etc.)

  Throws:
    `DocumentParseException`
    `DocumentException`

### createDocument

    public static IDocument createDocument(String xml,
                                           boolean deferParse)
                                    throws DocumentParseException,
                                           DocumentException

  Create a document using the given XML text, optionally deferring the parse of that XML until a later time. In other words until any access that would require a parsed DOM.

  Throws:
    `DocumentParseException`
    `DocumentException`

### createDocument

    public static IDocument createDocument(Element documentRootElement)

  Create a document using a copy of the given Element as the document root element.

### createDocument

    public static IDocument createDocument(Reader reader)
                                    throws DocumentParseException,
                                           DocumentException

  Create a document by reading the XML text for the document from the given Reader.

  Throws:
    `DocumentParseException`
    `DocumentException`

### createDocument

    public static IDocument createDocument(File file)
                                    throws DocumentParseException,
                                           DocumentException

  Create a document by reading XML text previously saved to a file. The data within this file will be interpreted according to the default XML encodings UTF-8 or UTF-16, or according to the encoding value specified in the XML declaration embedded in the XML text. The detection of the desired encoding is left up to the XML parser. It will auto-detect the encoding and proceed if it finds a supported encoding is in use. In general, if this method is used to populate an IDocument instance, the method getEncoding() on this instance will return null, as it is impossible for the instance to determine the actual encoding in use. This knowledge is restricted to the XML parser itself, and there is no standard mechanism for retrieving the encoding from the XML parser. If the encoding for the data in this file is know, it is recommended that you specify the encoding by using the createDocument(File, String) method instead.

  Parameters:
    `file` -
  Throws:
    `DocumentParseException`
    `DocumentException`
  See Also:
    `createDocument(File, String)`

### createDocument

    public static IDocument createDocument(File file,
                                           String encoding)
                                    throws DocumentParseException,
                                           DocumentException

  Create a document by reading XML text previously saved to a file. The data within this file will be interpreted according to the given encoding value.

  Parameters:
    `file` -
    `encoding` - The Java encoding style for the content in the given file.
  Throws:
    `DocumentParseException`
    `DocumentException`

### createDocument

    public static IDocument createDocument(InputSource inputSource)
                                    throws DocumentParseException,
                                           DocumentException

  Create a document by reading the XML text for the document from the given InputSource.

  Throws:
    `DocumentParseException`
    `DocumentException`

### createDocument

    public static IDocument createDocument(Document document)

  Create a document using the given DOM document. This DOM document is used as is, and is NOT copied.

### createDocument

    public static IDocument createDocument(IDocument document)

  Create a new document that is a deep copy of the given document. The new document is independent of (not linked to) the old document.

### generateNamespacePrefix

    public static String generateNamespacePrefix(String namespaceURI)

  Generate a namespace prefix based on the given namespace URI.

### createDocumentDefinition

    public static IDocumentDefinition createDocumentDefinition()

  Create a document definition instance. The returned instance has no name and no schema.

### createDocumentDefinition

    public static IDocumentDefinition createDocumentDefinition(String documentTypeName)

  Create a document definition with the given document type name. The returned instance has no schema.

### createNullDocumentDefinition

    public static IDocumentDefinition createNullDocumentDefinition()

  Create a document definition for an empty/null document type. The returned instance will return true from the isNull() method, and cannot store a schema, but can be used to store a name and description.

### serializeElement

    public static String serializeElement(Element elem)
                                   throws DocumentException

  Serialize the given Element out as XML and return a String.

  Throws:
    `DocumentException`

### serializeElement

    public static void serializeElement(Writer writer,
                                        Element elem)
                                 throws IOException,
                                        DocumentException

  Serialize the given Element as XML out to the given Writer.

  Throws:
    `IOException`
    `DocumentException`

### serializeElement

    public static void serializeElement(Writer writer,
                                        int indent,
                                        int indentSize,
                                        Element elem)
                                 throws IOException,
                                        DocumentException

  Serialize the given Element as XML out to the given Writer, using the given indent level and indentSize. For example, if you wish to serialize an element with a base indent of 10 spaces and each level under the element to be indented by 2 spaces, pass indent 10 and indentSize 2.

  Throws:
    `IOException`
    `DocumentException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD