Package org.apache.poi.ooxml.util
Class DocumentHelper
java.lang.Object
org.apache.poi.ooxml.util.DocumentHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddNamespaceDeclaration(Element element, String namespacePrefix, String namespaceURI) Adds a namespace declaration attribute to the given element.static voidaddNamespaceDeclaration(Element element, Namespace namespace) Adds a namespace declaration attribute to the given element.static DocumentCreates a new DOM Documentstatic DocumentBuilderCreates a new document builder, with sensible defaultsstatic DocumentreadDocument(InputStream inp) Parses the given stream via the default (sensible) DocumentBuilderstatic DocumentreadDocument(InputSource inp) Parses the given stream via the default (sensible) DocumentBuilder
-
Method Details
-
newDocumentBuilder
Creates a new document builder, with sensible defaults- Throws:
IllegalStateException- If creating the DocumentBuilder fails, e.g. due toParserConfigurationException.
-
readDocument
Parses the given stream via the default (sensible) DocumentBuilder- Parameters:
inp- Stream to read the XML data from- Returns:
- the parsed Document
- Throws:
IOExceptionSAXException
-
readDocument
Parses the given stream via the default (sensible) DocumentBuilder- Parameters:
inp- sax source to read the XML data from- Returns:
- the parsed Document
- Throws:
IOExceptionSAXException
-
createDocument
Creates a new DOM Document -
addNamespaceDeclaration
public static void addNamespaceDeclaration(Element element, String namespacePrefix, String namespaceURI) Adds a namespace declaration attribute to the given element. -
addNamespaceDeclaration
Adds a namespace declaration attribute to the given element.
-