public class W3CDom extends Object
Document
to a org.w3c.dom.Document
,
for integration with toolsets that use the W3C DOM.Modifier and Type | Class and Description |
---|---|
protected static class |
W3CDom.W3CBuilder
Implements the conversion by walking the input.
|
Modifier and Type | Field and Description |
---|---|
protected DocumentBuilderFactory |
factory |
Constructor and Description |
---|
W3CDom() |
Modifier and Type | Method and Description |
---|---|
String |
asString(Document doc)
Serialize a W3C document to a String.
|
static String |
asString(Document doc,
Map<String,String> properties)
Serialize a W3C document to a String.
|
static Document |
convert(Document in)
Converts a jsoup DOM to a W3C DOM
|
void |
convert(Document in,
Document out)
Converts a jsoup document into the provided W3C Document.
|
Document |
fromJsoup(Document in)
Convert a jsoup Document to a W3C Document.
|
static HashMap<String,String> |
OutputHtml()
Canned default for HTML output.
|
static HashMap<String,String> |
OutputXml()
Canned default for XML output.
|
protected DocumentBuilderFactory factory
public static Document convert(Document in)
in
- jsoup Documentpublic static String asString(Document doc, @Nullable Map<String,String> properties)
null
), the output will be auto-detected based on the content of the
document.doc
- Documentproperties
- (optional/nullable) the output properties to use. See Transformer.setOutputProperties(Properties)
and OutputKeys
OutputHtml()
,
OutputXml()
,
OutputKeys.ENCODING
,
OutputKeys.OMIT_XML_DECLARATION
,
OutputKeys.STANDALONE
,
OutputKeys.STANDALONE
,
OutputKeys.DOCTYPE_PUBLIC
,
OutputKeys.DOCTYPE_PUBLIC
,
OutputKeys.CDATA_SECTION_ELEMENTS
,
OutputKeys.INDENT
,
OutputKeys.MEDIA_TYPE
public Document fromJsoup(Document in)
in
- jsoup docpublic void convert(Document in, Document out)
in
- jsoup docout
- w3c docfromJsoup(org.jsoup.nodes.Document)
public String asString(Document doc)
doc
- DocumentasString(Document, Map)
Copyright © 2009–2023 Jonathan Hedley. All rights reserved.