Package org.openbravo.dal.xml
Class XMLUtil
- java.lang.Object
-
- org.openbravo.dal.xml.XMLUtil
-
- All Implemented Interfaces:
OBProvidable
,OBSingleton
public class XMLUtil extends Object implements OBSingleton
Utility class for XML processing.- Author:
- mtaal
- See Also:
XMLEntityConverter
,EntityXMLConverter
,DalWebService
-
-
Constructor Summary
Constructors Constructor Description XMLUtil()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.dom4j.Element
addRootElement(org.dom4j.Document doc, String elementName)
Creates a standard Openbravo root element for a xml document and set ths namespace.org.dom4j.Document
createDomDocument()
static XMLUtil
getInstance()
org.dom4j.Element
getRootElement(InputStream in)
Parses provided InputStream into XML and extracts root elementDocumentBuilder
newDocumentBuilder()
SAXParser
newSAXParser()
org.dom4j.io.SAXReader
newSAXReader()
TransformerHandler
newSAXTransformerHandler()
TransformerFactory
newTransformerFactory()
static void
setInstance(XMLUtil instance)
String
toString(org.dom4j.Document document)
Converts a Dom4j document to a string.
-
-
-
Method Detail
-
getInstance
public static XMLUtil getInstance()
-
setInstance
public static void setInstance(XMLUtil instance)
-
createDomDocument
public org.dom4j.Document createDomDocument()
- Returns:
- a new Dom4j Document
-
newDocumentBuilder
public DocumentBuilder newDocumentBuilder() throws ParserConfigurationException
- Returns:
- a new secure
DocumentBuilder
- Throws:
ParserConfigurationException
-
newSAXTransformerHandler
public TransformerHandler newSAXTransformerHandler() throws TransformerConfigurationException
- Returns:
- a new secure
TransformerHandler
- Throws:
TransformerConfigurationException
-
newSAXReader
public org.dom4j.io.SAXReader newSAXReader() throws SAXException
- Returns:
- a new secure
SAXReader
- Throws:
SAXException
-
newSAXParser
public SAXParser newSAXParser() throws SAXException, ParserConfigurationException
- Returns:
- a new secure
SAXParser
- Throws:
SAXException
ParserConfigurationException
-
getRootElement
public org.dom4j.Element getRootElement(InputStream in)
Parses provided InputStream into XML and extracts root element- Parameters:
in
- InputStream XML- Returns:
- Element root element
-
newTransformerFactory
public TransformerFactory newTransformerFactory()
- Returns:
- a new secure
TransformerFactory
-
addRootElement
public org.dom4j.Element addRootElement(org.dom4j.Document doc, String elementName)
Creates a standard Openbravo root element for a xml document and set ths namespace. Ads the new root element to the Dom4j document.- Parameters:
doc
- the Dom4j document to set the root elementelementName
- the name of the root element- Returns:
- the new root element
-
toString
public String toString(org.dom4j.Document document)
Converts a Dom4j document to a string. A number of specific settings: 1) output encoding is UTF-8, 2) text nodes are not trimmed- Parameters:
document
- the Dom4j to convert to a XML string- Returns:
- the XML representation
-
-