Top Description Fields Constructors Methods
com.sun.msv.util.xml

public Class DOMBuilder

extends DefaultHandler
Class Inheritance
Imports
javax.xml.parsers.DocumentBuilderFactory, .ParserConfigurationException, org.w3c.dom.Document, .Element, .Node, org.xml.sax.Attributes, org.xml.sax.helpers.DefaultHandler

builds DOM from SAX2 event stream.
Author
Kohsuke KAWAGUCHI

Field Summary

Modifier and TypeField and Description
private final Document
private Node

Constructor Summary

AccessConstructor and Description
public
DOMBuilder(Document document)

public

Method Summary

Modifier and TypeMethod and Description
public void
characters(char[]
The characters.
buf
,
int
The start position in the character array.
start
,
int
The number of characters to use from the character array.
len
)

Overrides org.xml.sax.helpers.DefaultHandler.characters.

Implements org.xml.sax.ContentHandler.characters.

Receive notification of character data inside an element.
public void
endElement(String
The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
ns
,
String
The local name (without prefix), or the empty string if Namespace processing is not being performed.
local
,
String
The qualified name (with prefix), or the empty string if qualified names are not available.
qname
)

Overrides org.xml.sax.helpers.DefaultHandler.endElement.

Implements org.xml.sax.ContentHandler.endElement.

Receive notification of the end of an element.
public Document
getDocument()

returns DOM.

public void
ignorableWhitespace(char[]
The whitespace characters.
buf
,
int
The start position in the character array.
start
,
int
The number of characters to use from the character array.
len
)

Overrides org.xml.sax.helpers.DefaultHandler.ignorableWhitespace.

Implements org.xml.sax.ContentHandler.ignorableWhitespace.

Receive notification of ignorable whitespace in element content.
public void
startElement(String
The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
ns
,
String
The local name (without prefix), or the empty string if Namespace processing is not being performed.
local
,
String
The qualified name (with prefix), or the empty string if qualified names are not available.
qname
,
Attributes
The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
atts
)

Overrides org.xml.sax.helpers.DefaultHandler.startElement.

Implements org.xml.sax.ContentHandler.startElement.

Receive notification of the start of an element.
Inherited from org.xml.sax.helpers.DefaultHandler:
endDocumentendPrefixMappingerrorfatalErrornotationDeclprocessingInstructionresolveEntitysetDocumentLocatorskippedEntitystartDocumentstartPrefixMappingunparsedEntityDeclwarning

Field Detail

domback to summary
private final Document dom
parentback to summary
private Node parent

Constructor Detail

DOMBuilderback to summary
public DOMBuilder(Document document)
DOMBuilderback to summary
public DOMBuilder() throws ParserConfigurationException

Method Detail

charactersback to summary
public void characters(char[] buf, int start, int len)

Overrides org.xml.sax.helpers.DefaultHandler.characters.

Implements org.xml.sax.ContentHandler.characters.

Doc from org.xml.sax.helpers.DefaultHandler.characters.

Receive notification of character data inside an element.

By default, do nothing. Application writers may override this method to take specific actions for each chunk of character data (such as adding the data to a node or buffer, or printing it to a file).

Parameters
buf:char[]

The characters.

start:int

The start position in the character array.

len:int

The number of characters to use from the character array.

endElementback to summary
public void endElement(String ns, String local, String qname)

Overrides org.xml.sax.helpers.DefaultHandler.endElement.

Implements org.xml.sax.ContentHandler.endElement.

Doc from org.xml.sax.helpers.DefaultHandler.endElement.

Receive notification of the end of an element.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of each element (such as finalising a tree node or writing output to a file).

Parameters
ns:String

The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.

local:String

The local name (without prefix), or the empty string if Namespace processing is not being performed.

qname:String

The qualified name (with prefix), or the empty string if qualified names are not available.

getDocumentback to summary
public Document getDocument()

returns DOM. This method should be called after the parsing was completed.

ignorableWhitespaceback to summary
public void ignorableWhitespace(char[] buf, int start, int len)

Overrides org.xml.sax.helpers.DefaultHandler.ignorableWhitespace.

Implements org.xml.sax.ContentHandler.ignorableWhitespace.

Doc from org.xml.sax.helpers.DefaultHandler.ignorableWhitespace.

Receive notification of ignorable whitespace in element content.

By default, do nothing. Application writers may override this method to take specific actions for each chunk of ignorable whitespace (such as adding data to a node or buffer, or printing it to a file).

Parameters
buf:char[]

The whitespace characters.

start:int

The start position in the character array.

len:int

The number of characters to use from the character array.

startElementback to summary
public void startElement(String ns, String local, String qname, Attributes atts)

Overrides org.xml.sax.helpers.DefaultHandler.startElement.

Implements org.xml.sax.ContentHandler.startElement.

Doc from org.xml.sax.helpers.DefaultHandler.startElement.

Receive notification of the start of an element.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the start of each element (such as allocating a new tree node or writing output to a file).

Parameters
ns:String

The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.

local:String

The local name (without prefix), or the empty string if Namespace processing is not being performed.

qname:String

The qualified name (with prefix), or the empty string if qualified names are not available.

atts:Attributes

The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.