Package org.docx4j.org.apache.poi.util
Class DocumentHelper
java.lang.Object
org.docx4j.org.apache.poi.util.DocumentHelper
public final class DocumentHelper
extends java.lang.Object
-
Method Summary
Modifier and Type Method Description static voidaddNamespaceDeclaration(org.w3c.dom.Element element, java.lang.String namespacePrefix, java.lang.String namespaceURI)Adds a namespace declaration attribute to the given element.static voidaddNamespaceDeclaration(org.w3c.dom.Element element, javax.xml.stream.events.Namespace namespace)Adds a namespace declaration attribute to the given element.static org.w3c.dom.DocumentcreateDocument()Creates a new DOM Documentstatic javax.xml.parsers.DocumentBuildernewDocumentBuilder()Creates a new document builder, with sensible defaultsstatic org.w3c.dom.DocumentreadDocument(java.io.InputStream inp)Parses the given stream via the default (sensible) DocumentBuilder
-
Method Details
-
newDocumentBuilder
public static javax.xml.parsers.DocumentBuilder newDocumentBuilder()Creates a new document builder, with sensible defaults -
readDocument
public static org.w3c.dom.Document readDocument(java.io.InputStream inp) throws java.io.IOException, org.xml.sax.SAXExceptionParses the given stream via the default (sensible) DocumentBuilder- Parameters:
inp- Stream to read the XML data from- Returns:
- the parsed Document
- Throws:
java.io.IOExceptionorg.xml.sax.SAXException
-
createDocument
public static org.w3c.dom.Document createDocument()Creates a new DOM Document -
addNamespaceDeclaration
public static void addNamespaceDeclaration(org.w3c.dom.Element element, java.lang.String namespacePrefix, java.lang.String namespaceURI)Adds a namespace declaration attribute to the given element. -
addNamespaceDeclaration
public static void addNamespaceDeclaration(org.w3c.dom.Element element, javax.xml.stream.events.Namespace namespace)Adds a namespace declaration attribute to the given element.
-