public final class DocumentHelper
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
addNamespaceDeclaration(org.w3c.dom.Element element,
javax.xml.stream.events.Namespace namespace)
Adds a namespace declaration attribute to the given element.
|
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.
|
static org.w3c.dom.Document |
createDocument()
Creates a new DOM Document
|
static javax.xml.parsers.DocumentBuilder |
newDocumentBuilder()
Creates a new document builder, with sensible defaults
|
static org.w3c.dom.Document |
readDocument(org.xml.sax.InputSource inp)
Parses the given stream via the default (sensible)
DocumentBuilder
|
static org.w3c.dom.Document |
readDocument(java.io.InputStream inp)
Parses the given stream via the default (sensible)
DocumentBuilder
|
public static javax.xml.parsers.DocumentBuilder newDocumentBuilder()
java.lang.IllegalStateException
- If creating the DocumentBuilder fails, e.g.
due to ParserConfigurationException
.public static org.w3c.dom.Document readDocument(java.io.InputStream inp) throws java.io.IOException, org.xml.sax.SAXException
inp
- Stream to read the XML data fromjava.io.IOException
org.xml.sax.SAXException
public static org.w3c.dom.Document readDocument(org.xml.sax.InputSource inp) throws java.io.IOException, org.xml.sax.SAXException
inp
- sax source to read the XML data fromjava.io.IOException
org.xml.sax.SAXException
public static org.w3c.dom.Document createDocument()
public static void addNamespaceDeclaration(org.w3c.dom.Element element, java.lang.String namespacePrefix, java.lang.String namespaceURI)
public static void addNamespaceDeclaration(org.w3c.dom.Element element, javax.xml.stream.events.Namespace namespace)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.