Package com.mycila.xmltool
Class XMLDocBuilder
- java.lang.Object
-
- com.mycila.xmltool.XMLDocBuilder
-
public final class XMLDocBuilder extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private XMLDocDefinitiondefinition
-
Constructor Summary
Constructors Modifier Constructor Description privateXMLDocBuilder(XMLDocDefinition definition)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description XMLDocBuilderaddDefaultNamespace(java.lang.String defaultNamespaceURI)Set the default namespace to use in the document declaration.XMLDocBuilderaddNamespace(java.lang.String prefix, java.lang.String namespaceURI)Add a namespace to the document that will be createdXMLTagaddRoot(java.lang.String tagName)Create a root node for this XML documentprivate static voidclose(java.io.Closeable c)private static XMLTagcreate(XMLDocDefinition def)(package private) static XMLTagfrom(XMLTag tag, boolean ignoreNamespaces)(package private) static XMLTagfrom(java.io.File file, boolean ignoreNamespaces)(package private) static XMLTagfrom(java.io.InputStream is, boolean ignoreNamespaces)(package private) static XMLTagfrom(java.io.Reader reader, boolean ignoreNamespaces)(package private) static XMLTagfrom(java.lang.String xmlData, boolean ignoreNamespaces)(package private) static XMLTagfrom(java.net.URL xmlLocation, boolean ignoreNamespaces)(package private) static XMLTagfrom(javax.xml.transform.Source source, boolean ignoreNamespaces)(package private) static XMLTagfrom(org.w3c.dom.Node node, boolean ignoreNamespaces)(package private) static XMLTagfrom(org.xml.sax.InputSource source, boolean ignoreNamespaces)(package private) static XMLTagfromCurrentTag(XMLTag tag, boolean ignoreNamespaces)private static booleanneedsNormalization(java.lang.String name)(package private) static XMLDocBuildernewDocument(boolean ignoreNamespaces)private static javax.xml.parsers.DocumentBuildernewDocumentBuilder(boolean ignoreNamespaces)
-
-
-
Field Detail
-
definition
private final XMLDocDefinition definition
-
-
Constructor Detail
-
XMLDocBuilder
private XMLDocBuilder(XMLDocDefinition definition)
-
-
Method Detail
-
addNamespace
public XMLDocBuilder addNamespace(java.lang.String prefix, java.lang.String namespaceURI)
Add a namespace to the document that will be created- Parameters:
prefix- The prefix of the namespacenamespaceURI- The URI of the namespace- Returns:
- this
-
addDefaultNamespace
public XMLDocBuilder addDefaultNamespace(java.lang.String defaultNamespaceURI)
Set the default namespace to use in the document declaration. I.e.<html xmlns="http://www.w3.org/1999/xhtml">- Parameters:
defaultNamespaceURI- URI to use as default when tags are not prefixed- Returns:
- this
-
addRoot
public XMLTag addRoot(java.lang.String tagName)
Create a root node for this XML document- Parameters:
tagName- Name of the element- Returns:
- XMLDoc instance to build and navigate in the document
-
create
private static XMLTag create(XMLDocDefinition def)
-
needsNormalization
private static boolean needsNormalization(java.lang.String name)
-
newDocument
static XMLDocBuilder newDocument(boolean ignoreNamespaces)
-
from
static XMLTag from(java.io.File file, boolean ignoreNamespaces)
-
from
static XMLTag from(java.net.URL xmlLocation, boolean ignoreNamespaces)
-
from
static XMLTag from(java.lang.String xmlData, boolean ignoreNamespaces)
-
from
static XMLTag from(java.io.Reader reader, boolean ignoreNamespaces)
-
from
static XMLTag from(java.io.InputStream is, boolean ignoreNamespaces)
-
from
static XMLTag from(org.xml.sax.InputSource source, boolean ignoreNamespaces)
-
from
static XMLTag from(org.w3c.dom.Node node, boolean ignoreNamespaces)
-
from
static XMLTag from(javax.xml.transform.Source source, boolean ignoreNamespaces)
-
close
private static void close(java.io.Closeable c)
-
newDocumentBuilder
private static javax.xml.parsers.DocumentBuilder newDocumentBuilder(boolean ignoreNamespaces)
-
-