net.rim.device.api.xml.jaxp
Class DOMInternalRepresentation

java.lang.Object
  extended by net.rim.device.api.xml.jaxp.DOMInternalRepresentation

public class DOMInternalRepresentation
extends Object

The class used to represent an XML document and to implement the W3C DOM.

Since:
BlackBerry API 4.0.0

Constructor Summary
DOMInternalRepresentation()
           
 
Method Summary
static void compress(Node n)
          Causes the DOM to compact the representation of the document containing the Node.
static void dump(Node n)
          Dump routine (for debugging only).
 boolean getCoalescing()
          Determines if this DOM merges whitespace.
 boolean getExpandingEntities()
          Determines if this DOM expands entities.
static DOMInternalRepresentation getIR(Node node)
          Given any DOM node, returns its associated DOMInternalRepresentation.
static void parse(Document document, DefaultHandler handler)
          Parses an internal representation and generates callbacks to a SAX handler.
 Document parse(InputSource is, SAXParser parser)
          Parses an XML document and returns a Document node.
 void parse(DefaultHandler handler)
          Parses an internal representation and generates callbacks to a SAX parser handler.
 DocumentFragment parseFragment(String str)
          Parses a string to produce a DocumentFragment node.
 void setCoalescing(boolean coalescing)
          Configures this DOM to turn CDATA sections into text nodes and merge adjacent text nodes.
 void setEntityResolver(EntityResolver er)
          Registers an entity resolver to use when parsing an XML document.
 void setErrorHandler(ErrorHandler eh)
          Registers an error handler to use when parsing an XML document.
 void setExpandingEntities(boolean expandingEntities)
          Configures this DOM to expand entities.
 void setIgnoringComments(boolean ignoreComments)
          Configure this DOM to discard comments.
 void setIgnoringWhitespace(boolean ignoreWhitespace)
          Configures this DOM to discard igorable whitespace, rather than saving it as text nodes.
 void setNamespaceAware(boolean aware)
          Configure this DOM to be namespace aware.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

DOMInternalRepresentation

public DOMInternalRepresentation()
Since:
BlackBerry API 4.0.0


Method Detail

parseFragment

public DocumentFragment parseFragment(String str)
                               throws SAXException,
                                      IOException

Parses a string to produce a DocumentFragment node.

Parameters:
str - The string to parse.
Returns:
A document fragment that represents the parsed string.
Throws:
IOException
SAXException
Since:
BlackBerry API 4.0.0

parse

public Document parse(InputSource is,
                      SAXParser parser)
               throws SAXException,
                      IOException
Parses an XML document and returns a Document node.

Parameters:
is - The XML document.
parser - A SAX parser capable of parsing the InputSource.
Returns:
A Document node that represents the XML document.
Throws:
SAXException
IOException
Since:
BlackBerry API 4.0.0

setErrorHandler

public void setErrorHandler(ErrorHandler eh)
Registers an error handler to use when parsing an XML document.

Parameters:
eh - An error handler.
Since:
BlackBerry API 4.0.0

setEntityResolver

public void setEntityResolver(EntityResolver er)
Registers an entity resolver to use when parsing an XML document.

Parameters:
er - An EntityResolver.
Since:
BlackBerry API 4.0.0

setCoalescing

public void setCoalescing(boolean coalescing)
Configures this DOM to turn CDATA sections into text nodes and merge adjacent text nodes.

Parameters:
coalescing - True to configure this DOM to turn CDATA sections into text nodes and merge adjacent text nodes; false otherwise.
Since:
BlackBerry API 4.0.0

setIgnoringWhitespace

public void setIgnoringWhitespace(boolean ignoreWhitespace)
Configures this DOM to discard igorable whitespace, rather than saving it as text nodes.

Parameters:
ignoreWhitespace - True to configure this DOM to discard ignorable whitespace; false otherwise.
Since:
BlackBerry API 4.0.0

setIgnoringComments

public void setIgnoringComments(boolean ignoreComments)
Configure this DOM to discard comments.

Parameters:
ignoreComments - True to configure this DOM to discard comments; false otherwise.
Since:
BlackBerry API 4.0.0

setNamespaceAware

public void setNamespaceAware(boolean aware)
Configure this DOM to be namespace aware.

Parameters:
aware - True to configure this DOM to be namespace aware; false otherwise.
Since:
BlackBerry API 4.3.0

setExpandingEntities

public void setExpandingEntities(boolean expandingEntities)
Configures this DOM to expand entities. When entities are not being expanded, an Entity node appears in the DOM. The children of the Entity represent its expansion. When entities are being expanded, no Entity node appears.

Parameters:
expandingEntities - True to expand entities; false otherwise.
Since:
BlackBerry API 4.0.0

getCoalescing

public boolean getCoalescing()
Determines if this DOM merges whitespace.

Returns:
True if this DOM merges whitespace; false otherwise.
Since:
BlackBerry API 4.0.0

getExpandingEntities

public boolean getExpandingEntities()
Determines if this DOM expands entities.

Returns:
True if this DOM expands entities; false otherwise.
Since:
BlackBerry API 4.0.0

getIR

public static DOMInternalRepresentation getIR(Node node)
Given any DOM node, returns its associated DOMInternalRepresentation.

Parameters:
node - A DOM node.
Returns:
The node's DOMInternalRepresentation.
Since:
BlackBerry API 4.0.0

parse

public static void parse(Document document,
                         DefaultHandler handler)
                  throws SAXException
Parses an internal representation and generates callbacks to a SAX handler. This is useful for creating serialization code, XML writers, and so on.

Parameters:
document - The document to parse.
handler - The SAX DefaultHandler that receives the callbacks.
Throws:
SAXException
Since:
BlackBerry API 4.0.0

parse

public void parse(DefaultHandler handler)
           throws SAXException
Parses an internal representation and generates callbacks to a SAX parser handler. This is useful for creating serialization code, XML writers, and so on.

Parameters:
handler - The SAX DefaultHandler that receives the callbacks.
Throws:
SAXException
Since:
BlackBerry API 4.0.0

compress

public static void compress(Node n)
Causes the DOM to compact the representation of the document containing the Node.

Parameters:
node - A DOM node.
Since:
BlackBerry API 4.0.0

dump

public static void dump(Node n)
Dump routine (for debugging only).

Parameters:
n - A node.
Since:
BlackBerry API 4.0.0





Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.