public class DOMBuilder
extends java.lang.Object
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(....);
构造器和说明 |
---|
DOMBuilder()
This creates a new DOMBuilder instance using the DefaultJDOMFactory
to build the JDOM content.
|
限定符和类型 | 方法和说明 |
---|---|
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.
|
public DOMBuilder()
public void setFactory(JDOMFactory factory)
factory
- JDOMFactory
to usepublic JDOMFactory getFactory()
JDOMFactory
in use.public Document build(org.w3c.dom.Document domDocument)
domDocument
- org.w3c.dom.Document
objectDocument
- JDOM document object.public Element build(org.w3c.dom.Element domElement)
domElement
- org.w3c.dom.Element
objectElement
- JDOM Element objectpublic CDATA build(org.w3c.dom.CDATASection cdata)
cdata
- org.w3c.dom.CDATASection
objectCDATA
- JDOM CDATA objectpublic Text build(org.w3c.dom.Text text)
text
- org.w3c.dom.Text
objectText
- JDOM Text objectpublic Comment build(org.w3c.dom.Comment comment)
comment
- org.w3c.dom.Comment
objectComment
- JDOM Comment objectpublic ProcessingInstruction build(org.w3c.dom.ProcessingInstruction pi)
pi
- org.w3c.dom.ProcessingInstruction
objectProcessingInstruction
- JDOM ProcessingInstruction objectpublic EntityRef build(org.w3c.dom.EntityReference er)
er
- org.w3c.dom.EntityReference
objectEnityRef
- JDOM EntityRef objectpublic DocType build(org.w3c.dom.DocumentType doctype)
doctype
- org.w3c.dom.Element
objectElement
- JDOM Element object