com.starteam.xml
Class XMLDocument

java.lang.Object
  extended by com.starteam.xml.XMLDocument

public final class XMLDocument
extends java.lang.Object

A simple XML document object model (DOM), with methods for parsing and writing XML. If the boolean retainDOM is set to true, then the structure of the DOM is maintained, so that a subsequent call to write(...) would reproduce the input to build(...) However, if set to false, then a subsequent call to write(...) would produce an empty DOM. Note that if retainDOM is set to true, then the XMLDocument maintains two versions of the DOM in memory - an XML representation and an SDK representation This is probably acceptable for small, short lived DOMs.

See Also:
XMLElement

Method Summary
static XMLDocument build(byte[] source, boolean retainDOM)
          Parses the XML document in the given source bytes.
static XMLDocument build(java.io.File source, boolean retainDOM)
          Parses the XML document in the given source file.
static XMLDocument build(java.io.InputStream source, boolean retainDOM)
          Parses the XML document in the given source.
 XMLElement getRootElement()
          Gets the root element of this document.
 void write(java.io.File out)
          Writes an XML representation of this document to the given file.
 void write(java.io.OutputStream out)
          Writes an XML representation of this document to the given output stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

build

public static XMLDocument build(java.io.File source,
                                boolean retainDOM)
                         throws java.io.FileNotFoundException,
                                java.io.IOException,
                                XMLException
Parses the XML document in the given source file.

Parameters:
source - An XML document.
retainDOM - True to retain the structure of the internal DOM, false to shred it
Returns:
A parsed DOM representation of the XML document.
Throws:
XMLException
java.io.FileNotFoundException
java.io.IOException

build

public static XMLDocument build(byte[] source,
                                boolean retainDOM)
                         throws java.io.IOException,
                                XMLException
Parses the XML document in the given source bytes.

Parameters:
source - An XML document.
retainDOM - True to retain the structure of the internal DOM, false to shred it
Returns:
A parsed DOM representation of the XML document.
Throws:
XMLException
java.io.IOException

build

public static XMLDocument build(java.io.InputStream source,
                                boolean retainDOM)
                         throws java.io.IOException,
                                XMLException
Parses the XML document in the given source.

Parameters:
source - An XML document.
retainDOM - True to retain the structure of the internal DOM, false to shred it
Returns:
A parsed DOM representation of the XML document.
Throws:
XMLException
java.io.IOException

write

public void write(java.io.File out)
           throws java.io.FileNotFoundException,
                  java.io.IOException,
                  XMLException
Writes an XML representation of this document to the given file.

Parameters:
out - The output file.
Throws:
XMLException
java.io.FileNotFoundException
java.io.IOException

write

public void write(java.io.OutputStream out)
           throws java.io.IOException,
                  XMLException
Writes an XML representation of this document to the given output stream.

Parameters:
out - The output stream.
Throws:
XMLException
java.io.IOException

getRootElement

public XMLElement getRootElement()
Gets the root element of this document.

Returns:
The root element of this document.


StarTeam SDK 14.0, Build 21
Copyright © 2003-2012 Borland Software Corporation. All rights reserved.