コード例 #1
0
 /**
  * Helper function to remove indentations.
  *
  * @param element
  */
 private void removeIndentations(OMElement element) {
   List<OMText> removables = new ArrayList<OMText>();
   removeIndentations(element, removables);
   for (OMText node : removables) {
     node.detach();
   }
 }
コード例 #2
0
 /**
  * Helper function to remove indentations.
  *
  * @param element
  * @param removables
  */
 private void removeIndentations(OMElement element, List<OMText> removables) {
   Iterator children = element.getChildren();
   while (children.hasNext()) {
     Object next = children.next();
     if (next instanceof OMText) {
       OMText text = (OMText) next;
       if (text.getText().trim().equals("")) {
         removables.add(text);
       }
     } else if (next instanceof OMElement) {
       removeIndentations((OMElement) next, removables);
     }
   }
 }