Class XMLDocBuilder

java.lang.Object
com.mycila.xmltool.XMLDocBuilder

public final class XMLDocBuilder extends Object
  • Field Details

  • Constructor Details

  • Method Details

    • addNamespace

      public XMLDocBuilder addNamespace(String prefix, String namespaceURI)
      Add a namespace to the document that will be created
      Parameters:
      prefix - The prefix of the namespace
      namespaceURI - The URI of the namespace
      Returns:
      this
    • addDefaultNamespace

      public XMLDocBuilder addDefaultNamespace(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(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(String name)
    • newDocument

      static XMLDocBuilder newDocument(boolean ignoreNamespaces)
    • from

      static XMLTag from(File file, boolean ignoreNamespaces)
    • from

      static XMLTag from(URL xmlLocation, boolean ignoreNamespaces)
    • from

      static XMLTag from(String xmlData, boolean ignoreNamespaces)
    • from

      static XMLTag from(Reader reader, boolean ignoreNamespaces)
    • from

      static XMLTag from(InputStream is, boolean ignoreNamespaces)
    • from

      static XMLTag from(InputSource source, boolean ignoreNamespaces)
    • from

      static XMLTag from(Node node, boolean ignoreNamespaces)
    • from

      static XMLTag from(XMLTag tag, boolean ignoreNamespaces)
    • fromCurrentTag

      static XMLTag fromCurrentTag(XMLTag tag, boolean ignoreNamespaces)
    • from

      static XMLTag from(Source source, boolean ignoreNamespaces)
    • close

      private static void close(Closeable c)
    • newDocumentBuilder

      private static DocumentBuilder newDocumentBuilder(boolean ignoreNamespaces)