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(....);
| Modifier and Type | Field and Description |
|---|---|
| private JDOMFactory | factory
The factory for creating new JDOM objects |
| Access | Constructor and Description |
|---|---|
| public | DOMBuilder()
This creates a new DOMBuilder instance using the DefaultJDOMFactory to build the JDOM content. |
| Modifier and Type | Method and Description |
|---|---|
| public Document | |
| public Element | |
| public CDATA | Returns: CDATA - JDOM CDATA object org.w3c.dom.CDATASection objectThis will build a JDOM CDATA from an existing DOM CDATASection |
| public Text | |
| public Comment | |
| public ProcessingInstruction | Returns: ProcessingInstruction - JDOM ProcessingInstruction object org.w3c.dom.ProcessingInstruction objectThis will build a JDOM ProcessingInstruction from an existing DOM ProcessingInstruction |
| public EntityRef | Returns: EnityRef - JDOM EntityRef object org.w3c.dom.EntityReference objectThis will build a JDOM EntityRef from an existing DOM EntityReference |
| public DocType | Returns: Element - JDOM Element object org.w3c.dom.Element objectThis will build a JDOM Element from an existing DOM Element |
| private void | |
| public JDOMFactory | |
| public void |
| factory | back to summary |
|---|---|
| private JDOMFactory factory The factory for creating new JDOM objects | |
| DOMBuilder | back to summary |
|---|---|
| public DOMBuilder() This creates a new DOMBuilder instance using the DefaultJDOMFactory to build the JDOM content. | |
| build | back to summary |
|---|---|
| public Document build(Document domDocument) This will build a JDOM tree from an existing DOM tree. | |
| build | back to summary |
|---|---|
| public Element build(Element domElement) This will build a JDOM Element from an existing DOM Element | |
| build | back to summary |
|---|---|
| public CDATA build(CDATASection cdata) This will build a JDOM CDATA from an existing DOM CDATASection
| |
| build | back to summary |
|---|---|
| public Text build(Text text) This will build a JDOM Text from an existing DOM Text | |
| build | back to summary |
|---|---|
| public Comment build(Comment comment) This will build a JDOM Comment from an existing DOM Comment | |
| build | back to summary |
|---|---|
| public ProcessingInstruction build(ProcessingInstruction pi) This will build a JDOM ProcessingInstruction from an existing DOM ProcessingInstruction
| |
| build | back to summary |
|---|---|
| public EntityRef build(EntityReference er) This will build a JDOM EntityRef from an existing DOM EntityReference
| |
| build | back to summary |
|---|---|
| public DocType build(DocumentType doctype) This will build a JDOM Element from an existing DOM Element
| |
| buildTree | back to summary |
|---|---|
| private void buildTree(Node node, Document doc, Element current, boolean atRoot) This takes a DOM | |
| getFactory | back to summary |
|---|---|
| public JDOMFactory getFactory() Returns the current
| |
| setFactory | back to summary |
|---|---|
| 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.
| |