public class ModelConverter
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
protected static class |
ModelConverter.NamespaceStack |
Constructor and Description |
---|
ModelConverter()
Initialize the new instance with default values.
|
Modifier and Type | Method and Description |
---|---|
protected void |
convertAttributes(Element element,
org.w3c.dom.Element domElement,
ModelConverter.NamespaceStack namespaces) |
protected void |
convertChildren(Element element,
org.w3c.dom.Element domElement,
ModelConverter.NamespaceStack namespaces) |
protected org.w3c.dom.Element |
convertElement(Element element,
ModelConverter.NamespaceStack namespaces) |
protected org.w3c.dom.ProcessingInstruction |
convertProcessingInstruction(XmlProcessingInstruction pi) |
protected void |
convertProcessingInstructions(XmlDocument xmlDocument) |
protected void |
convertText(Element element,
org.w3c.dom.Element domElement) |
protected void |
convertToDOM(Element rootElement,
boolean createNewDocument)
Converts the given SIX element and its children to a DOM Document tree.
|
protected org.w3c.dom.Element |
createDOMElement(java.lang.String name,
ModelConverter.NamespaceStack namespaces) |
protected org.w3c.dom.ProcessingInstruction |
createDOMProcessingInstruction(java.lang.String target,
java.lang.String data) |
protected org.w3c.dom.Text |
createDOMText(java.lang.String text) |
protected org.w3c.dom.Document |
getDocument() |
protected Logger |
logger()
Returns the current logger used by this component to report
errors and exceptions.
|
protected void |
newDocument() |
protected void |
setDocument(org.w3c.dom.Document newValue) |
org.w3c.dom.Document |
toDOM(Element rootElement)
Converts the given SIX element and its children (Elements and Processing instructions)
to a DOM Document tree.
|
org.w3c.dom.Document |
toDOM(XmlDocument xmlDocument)
Converts the given SIX XML document and all its children (Elements and Processing instructions)
to a DOM Document tree.
|
java.lang.String |
toFormattedString(Element element)
Returns the element and its attributes and children as string with
new lines and indentation (2 chars).
|
java.lang.String |
toFormattedString(org.w3c.dom.Element element)
Returns the element and its attributes and children as string with
new lines and indentation (2 chars).
|
java.lang.String |
toFormattedString(Element element,
int indent)
Returns the element and its attributes and children as string with
new lines and indentation.
|
java.lang.String |
toFormattedString(org.w3c.dom.Element element,
int indent)
Returns the element and its attributes and children as string with
new lines and indentation.
|
java.lang.String |
toFormattedString(Element element,
int indent,
boolean useSingleQuotes)
Returns the element and its attributes and children as string with
new lines and indentation.
|
java.lang.String |
toFormattedString(org.w3c.dom.Element element,
int indent,
boolean useSingleQuotes)
Returns the element and its attributes and children as string with
new lines and indentation.
|
protected org.pfsw.six.StringTagInterpreterController |
toSIX(org.w3c.dom.Document doc)
Converts the given DOM Document tree to a SIX element tree.
|
XmlDocument |
toSIXDocument(org.w3c.dom.Document doc)
Converts the given DOM Document tree to a SIX XmlDocument tree.
|
Element |
toSIXElement(org.w3c.dom.Document doc)
Converts the given DOM Document tree to a SIX element tree.
|
Element |
toSIXElement(org.w3c.dom.Element domElement)
Converts the given DOM Element tree to a SIX element tree.
|
public ModelConverter()
public org.w3c.dom.Document toDOM(XmlDocument xmlDocument)
xmlDocument
- The SIX XML document to convert to a DOM document (must not be null).public org.w3c.dom.Document toDOM(Element rootElement)
rootElement
- The root element for the document to create.public XmlDocument toSIXDocument(org.w3c.dom.Document doc)
doc
- The document to be converted to the SIX structure.public Element toSIXElement(org.w3c.dom.Document doc)
doc
- The document to be converted to the SIX structurepublic Element toSIXElement(org.w3c.dom.Element domElement)
domElement
- The root element to start converting to the SIX structurepublic java.lang.String toFormattedString(Element element)
element
- An XML element, which is not necessarily the root of an XML documentpublic java.lang.String toFormattedString(Element element, int indent)
element
- An XML element, which is not necessarily the root of an XML documentindent
- Specifies how much characters to indent after a new linepublic java.lang.String toFormattedString(Element element, int indent, boolean useSingleQuotes)
element
- An XML element, which is not necessarily the root of an XML documentindent
- Specifies how much characters to indent after a new lineuseSingleQuotes
- If true attribute values will be enclosed in quotes ('), otherwise in apostrophes (")public java.lang.String toFormattedString(org.w3c.dom.Element element)
element
- A DOM element, which is not necessarily the root of an XML documentpublic java.lang.String toFormattedString(org.w3c.dom.Element element, int indent)
element
- A DOM element, which is not necessarily the root of an XML documentindent
- Specifies how much characters to indent after a new linepublic java.lang.String toFormattedString(org.w3c.dom.Element element, int indent, boolean useSingleQuotes)
element
- A DOM element, which is not necessarily the root of an XML documentindent
- Specifies how much characters to indent after a new lineuseSingleQuotes
- If true attribute values will be enclosed in quotes ('), otherwise in apostrophes (")protected void convertToDOM(Element rootElement, boolean createNewDocument)
rootElement
- The root element for the document to create.createNewDocument
- If true this method creates a new document, otherwise
it assumes that there is already one available via getDocument()
.protected org.pfsw.six.StringTagInterpreterController toSIX(org.w3c.dom.Document doc)
doc
- The document to be converted to the SIX structure.protected org.w3c.dom.Element convertElement(Element element, ModelConverter.NamespaceStack namespaces)
protected void convertText(Element element, org.w3c.dom.Element domElement)
protected void convertAttributes(Element element, org.w3c.dom.Element domElement, ModelConverter.NamespaceStack namespaces)
protected org.w3c.dom.ProcessingInstruction convertProcessingInstruction(XmlProcessingInstruction pi)
protected void convertChildren(Element element, org.w3c.dom.Element domElement, ModelConverter.NamespaceStack namespaces)
protected void convertProcessingInstructions(XmlDocument xmlDocument)
protected void newDocument()
protected org.w3c.dom.Element createDOMElement(java.lang.String name, ModelConverter.NamespaceStack namespaces)
protected org.w3c.dom.ProcessingInstruction createDOMProcessingInstruction(java.lang.String target, java.lang.String data)
protected org.w3c.dom.Text createDOMText(java.lang.String text)
protected org.w3c.dom.Document getDocument()
protected void setDocument(org.w3c.dom.Document newValue)
protected Logger logger()