2 Trim Spaces of Paragraphs

<..trim() para..>
 <script element="para" >
    <dom name="." xml="." method="para" class="tex4ht.DbUtilities" />
 </script>
-_-_-

<..static void para(dom)..>
 public static void para(Node dom) {
    Node pNode = dom.getFirstChild();
    if( pNode.hasChildNodes() ){
       Node child = pNode.getFirstChild();
       if( child != null ){
          if(  (child.getNodeType() == Node.TEXT_NODE)
             &&
               ((Text) child).getWholeText().trim().equals("")
          ){
             pNode.removeChild( child );
    }  }  }
    if( pNode.hasChildNodes() ){
       Node child = pNode.getLastChild();
       if( child != null ){
          if(  (child.getNodeType() == Node.TEXT_NODE)
             &&
               ((Text) child).getWholeText().trim().equals("")
          ){
             pNode.removeChild( child );
    }  }  }
    if( pNode.hasChildNodes() ){
       Node child = pNode.getFirstChild();
       if(    (child != null)
           && (child.getNextSibling() == null)
           && (child.getNodeType() == Node.TEXT_NODE)
       ){
          String txt = ((Text) child).getWholeText();
          String trm = txt.trim();
          if( !trm.equals(txt) ){
             ((Text)child).replaceWholeText(trm);
    }  }  }
 }
-_-_-