Package org.apache.poi.ooxml.util
Class DocumentHelper
java.lang.Object
org.apache.poi.ooxml.util.DocumentHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addNamespaceDeclaration
(Element element, String namespacePrefix, String namespaceURI) Adds a namespace declaration attribute to the given element.static void
addNamespaceDeclaration
(Element element, Namespace namespace) Adds a namespace declaration attribute to the given element.static Document
Creates a new DOM Documentstatic DocumentBuilder
Creates a new document builder, with sensible defaultsstatic Document
readDocument
(InputStream inp) Parses the given stream via the default (sensible) DocumentBuilderstatic Document
readDocument
(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:
IOException
SAXException
-
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:
IOException
SAXException
-
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.
-