JDOM
2.0.5

org.jdom2.input
Class DOMBuilder

java.lang.Object
  extended by org.jdom2.input.DOMBuilder

public class DOMBuilder
extends java.lang.Object

Builds a JDOM Document from a pre-existing DOM org.w3c.dom.Document.

If you are building a document that has Namespace declarations, you should ensure that the Namespaces are correctly recorded in the DOM document before building the JDOM document from the DOM. By default, the native Java DOMBuilderFactory is configured to ignore Namespaces, and thus they are 'lost' in the DOM tree. JDOM expects Namespace-aware documents, so you should ensure that you change the default settings on the DOMBuilderFactory before parsing the DOM document. For example:

     DocumentBuilderFactory domfactory = DocumentBuilderFactory.newInstance();
     domfactory.setNamespaceAware(true);
     DocumentBuilder dombuilder = domfac.newDocumentBuilder();
     org.w3c.dom.Document doc = dombuilder.parse(....);
 

Author:
Brett McLaughlin, Jason Hunter, Philip Nelson, Kevin Regan, Yusuf Goolamabbas, Dan Schaffer, Bradley S. Huffman

Constructor Summary
DOMBuilder()
          This creates a new DOMBuilder instance using the DefaultJDOMFactory to build the JDOM content.
 
Method Summary
 CDATA build(org.w3c.dom.CDATASection cdata)
          This will build a JDOM CDATA from an existing DOM CDATASection
 Comment build(org.w3c.dom.Comment comment)
          This will build a JDOM Comment from an existing DOM Comment
 Document build(org.w3c.dom.Document domDocument)
          This will build a JDOM tree from an existing DOM tree.
 DocType build(org.w3c.dom.DocumentType doctype)
          This will build a JDOM Element from an existing DOM Element
 Element build(org.w3c.dom.Element domElement)
          This will build a JDOM Element from an existing DOM Element
 EntityRef build(org.w3c.dom.EntityReference er)
          This will build a JDOM EntityRef from an existing DOM EntityReference
 ProcessingInstruction build(org.w3c.dom.ProcessingInstruction pi)
          This will build a JDOM ProcessingInstruction from an existing DOM ProcessingInstruction
 Text build(org.w3c.dom.Text text)
          This will build a JDOM Text from an existing DOM Text
 JDOMFactory getFactory()
          Returns the current JDOMFactory in use.
 void setFactory(JDOMFactory factory)
          This sets a custom JDOMFactory for the builder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DOMBuilder

public DOMBuilder()
This creates a new DOMBuilder instance using the DefaultJDOMFactory to build the JDOM content.

Method Detail

setFactory

public void setFactory(JDOMFactory factory)
This sets a custom JDOMFactory for the builder. Use this to build the tree with your own subclasses of the JDOM classes.

Parameters:
factory - JDOMFactory to use

getFactory

public JDOMFactory getFactory()
Returns the current JDOMFactory in use.

Returns:
the factory in use

build

public Document build(org.w3c.dom.Document domDocument)
This will build a JDOM tree from an existing DOM tree.

Parameters:
domDocument - org.w3c.dom.Document object
Returns:
Document - JDOM document object.

build

public Element build(org.w3c.dom.Element domElement)
This will build a JDOM Element from an existing DOM Element

Parameters:
domElement - org.w3c.dom.Element object
Returns:
Element - JDOM Element object

build

public CDATA build(org.w3c.dom.CDATASection cdata)
This will build a JDOM CDATA from an existing DOM CDATASection

Parameters:
cdata - org.w3c.dom.CDATASection object
Returns:
CDATA - JDOM CDATA object
Since:
JDOM2

build

public Text build(org.w3c.dom.Text text)
This will build a JDOM Text from an existing DOM Text

Parameters:
text - org.w3c.dom.Text object
Returns:
Text - JDOM Text object
Since:
JDOM2

build

public Comment build(org.w3c.dom.Comment comment)
This will build a JDOM Comment from an existing DOM Comment

Parameters:
comment - org.w3c.dom.Comment object
Returns:
Comment - JDOM Comment object
Since:
JDOM2

build

public ProcessingInstruction build(org.w3c.dom.ProcessingInstruction pi)
This will build a JDOM ProcessingInstruction from an existing DOM ProcessingInstruction

Parameters:
pi - org.w3c.dom.ProcessingInstruction object
Returns:
ProcessingInstruction - JDOM ProcessingInstruction object
Since:
JDOM2

build

public EntityRef build(org.w3c.dom.EntityReference er)
This will build a JDOM EntityRef from an existing DOM EntityReference

Parameters:
er - org.w3c.dom.EntityReference object
Returns:
EnityRef - JDOM EntityRef object
Since:
JDOM2

build

public DocType build(org.w3c.dom.DocumentType doctype)
This will build a JDOM Element from an existing DOM Element

Parameters:
doctype - org.w3c.dom.Element object
Returns:
Element - JDOM Element object
Since:
JDOM2

JDOM
2.0.5

Copyright � 2013 Jason Hunter, Brett McLaughlin. All Rights Reserved.