Class NormalizedSource

  • All Implemented Interfaces:
    javax.xml.transform.Source

    public class NormalizedSource
    extends javax.xml.transform.dom.DOMSource
    Performs XML normalization on a given Source, Document or Node.

    For Nodes this means adjacent text nodes are merged to single nodes and empty Text nodes removed (recursively). For Documents and Sources additional normalization steps may be taken depending on your DOMConfiguration. See the linked JavaDocs for details.

    When reading documents a parser usually puts the document into normalized form anway. You will only need to perform XML normalization on DOM trees you have created programmatically.

    See Also:
    "http://docs.oracle.com/javase/6/docs/api/org/w3c/dom/Document.html#normalizeDocument%28%29", "http://docs.oracle.com/javase/6/docs/api/org/w3c/dom/Node.html#normalize%28%29"
    • Field Summary

      • Fields inherited from class javax.xml.transform.dom.DOMSource

        FEATURE
    • Constructor Summary

      Constructors 
      Constructor Description
      NormalizedSource()  
      NormalizedSource​(javax.xml.transform.Source originalSource)
      Creates a new source that is created by "normalizing" the given source.
      NormalizedSource​(org.w3c.dom.Document doc)
      Creates a new source that is created by "normalizing" the given document.
      NormalizedSource​(org.w3c.dom.Document doc, java.lang.String systemId)
      Creates a new source that is created by "normalizing" the given document.
      NormalizedSource​(org.w3c.dom.Node n)
      Creates a new source that is created by "normalizing" the given node.
      NormalizedSource​(org.w3c.dom.Node n, java.lang.String systemId)
      Creates a new source that is created by "normalizing" the given node.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void setNode​(org.w3c.dom.Node n)  
      private void setNormalizedNode​(org.w3c.dom.Node n)  
      • Methods inherited from class javax.xml.transform.dom.DOMSource

        getNode, getSystemId, isEmpty, setSystemId
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NormalizedSource

        public NormalizedSource()
      • NormalizedSource

        public NormalizedSource​(javax.xml.transform.Source originalSource)
        Creates a new source that is created by "normalizing" the given source.

        See the class-level JavaDocs for details.

        Parameters:
        originalSource - the original source
      • NormalizedSource

        public NormalizedSource​(org.w3c.dom.Document doc)
        Creates a new source that is created by "normalizing" the given document.

        See the class-level JavaDocs for details.

        Parameters:
        doc - the original source
      • NormalizedSource

        public NormalizedSource​(org.w3c.dom.Document doc,
                                java.lang.String systemId)
        Creates a new source that is created by "normalizing" the given document.

        See the class-level JavaDocs for details.

        Parameters:
        doc - the original source
        systemId - the system id to use for the new source
      • NormalizedSource

        public NormalizedSource​(org.w3c.dom.Node n)
        Creates a new source that is created by "normalizing" the given node.

        See the class-level JavaDocs for details.

        Parameters:
        n - the original node
      • NormalizedSource

        public NormalizedSource​(org.w3c.dom.Node n,
                                java.lang.String systemId)
        Creates a new source that is created by "normalizing" the given node.

        See the class-level JavaDocs for details.

        Parameters:
        n - the original node
        systemId - the system id to use for the new source
    • Method Detail

      • setNode

        public void setNode​(org.w3c.dom.Node n)
        Overrides:
        setNode in class javax.xml.transform.dom.DOMSource
      • setNormalizedNode

        private void setNormalizedNode​(org.w3c.dom.Node n)