Interface XmlDocumentBuilder


public interface XmlDocumentBuilder
The xml document builder wraps the functionality of DocumentBuilderFactory. Checked exceptions will be wrapped into XmlRuntimeException.
Author:
Christian Bremer
  • Method Details

    • newInstance

      static XmlDocumentBuilder newInstance()
      Creates default builder instance.
      Returns:
      the default builder instance
    • configureFactory

      Configures the DocumentBuilderFactory. The default xml document builder has the same default values as the underlying factory except that DocumentBuilderFactory.setNamespaceAware(boolean) is set to true.
      Parameters:
      configurator - the configurator
      Returns:
      the xml document builder
    • configureFactory

      XmlDocumentBuilder configureFactory(Boolean coalescing, Boolean expandEntityReferences, Boolean ignoringComments, Boolean ignoringElementContentWhitespace, Boolean namespaceAware, Boolean validating, Boolean xIncludeAware)
      Configures the DocumentBuilderFactory. The default xml document builder has the same default values as the underlying factory except that DocumentBuilderFactory.setNamespaceAware(boolean) is set to true.

      A value with null will be ignored and the default will be used.

      The default values are:

       coalescing                       = false
       expandEntityReferences           = true
       ignoringComments                 = false
       ignoringElementContentWhitespace = false
       namespaceAware                   = true
       validating                       = false
       xIncludeAware                    = false
       
      Parameters:
      coalescing - the coalescing
      expandEntityReferences - the expanded entity references
      ignoringComments - the ignoring comments
      ignoringElementContentWhitespace - the ignoring element content whitespace
      namespaceAware - the namespace aware
      validating - the validating
      xIncludeAware - the x include aware
      Returns:
      the xml document builder
    • configureFactoryAttribute

      XmlDocumentBuilder configureFactoryAttribute(String name, Object value)
      Sets the given attribute to the underlying DocumentBuilderFactory.
      Parameters:
      name - the name
      value - the value
      Returns:
      the xml document builder
      See Also:
    • configureFactoryFeature

      XmlDocumentBuilder configureFactoryFeature(String name, boolean value)
      Sets the given feature to the underlying DocumentBuilderFactory.
      Parameters:
      name - the name
      value - the value
      Returns:
      the xml document builder
      See Also:
    • configureFactorySchema

      XmlDocumentBuilder configureFactorySchema(Schema schema)
      Sets the given schema to the underlying DocumentBuilderFactory.
      Parameters:
      schema - the schema
      Returns:
      the xml document builder
      See Also:
    • configureEntityResolver

      XmlDocumentBuilder configureEntityResolver(EntityResolver entityResolver)
      Sets the entity resolver to the created DocumentBuilder.
      Parameters:
      entityResolver - the entity resolver
      Returns:
      the xml document builder
      See Also:
    • configureErrorHandler

      XmlDocumentBuilder configureErrorHandler(ErrorHandler errorHandler)
      Sets error handler to the created DocumentBuilder.
      Parameters:
      errorHandler - the error handler
      Returns:
      the xml document builder
      See Also:
    • buildDocumentBuilder

      DocumentBuilder buildDocumentBuilder()
      Creates a new document builder.
      Returns:
      the document builder
    • buildDocument

      Document buildDocument()
      Builds an empty document.
      Returns:
      the document
    • buildDocument

      Document buildDocument(File file)
      Builds document from file.
      Parameters:
      file - the file
      Returns:
      the document
    • buildDocument

      Document buildDocument(String uri)
      Builds document from uri.
      Parameters:
      uri - the uri
      Returns:
      the document
    • buildDocument

      Document buildDocument(InputSource is)
      Builds document from input source.
      Parameters:
      is - the input source
      Returns:
      the document
    • buildDocument

      Document buildDocument(InputStream is)
      Builds document from input stream.
      Parameters:
      is - the input stream
      Returns:
      the document
    • buildDocument

      Document buildDocument(InputStream is, String systemId)
      Builds document from input stream and system ID.
      Parameters:
      is - the input stream
      systemId - the system id
      Returns:
      the document
    • buildDocument

      Document buildDocument(Object jaxbElement, jakarta.xml.bind.JAXBContext jaxbContext)
      Builds document from an object (POJO) that can be processed with JAXBContext.
      Parameters:
      jaxbElement - the jaxb element
      jaxbContext - the jaxb context
      Returns:
      the document
    • buildDocument

      Document buildDocument(Object jaxbElement, jakarta.xml.bind.Marshaller marshaller)
      Builds document from an object (POJO) that can be processed with Marshaller.
      Parameters:
      jaxbElement - the jaxb element
      marshaller - the marshaller
      Returns:
      the document