- Timestamp:
- 2012-06-13T21:00:45+12:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/util/XMLTools.java
r25710 r25786 814 814 while (child != null) 815 815 { 816 // first clear all empty text nodes (those containing space characters like \n,\r,\t and such) 817 if(child.getNodeType() == Node.TEXT_NODE && child.getNodeValue().matches("^\\s*$")) 818 { 819 Node spaceTextNode = child; 820 child = child.getNextSibling(); 821 elem.removeChild(spaceTextNode); 822 823 if(child == null) break; 824 } 825 826 // now process normal element nodes as intended 816 827 if (child.getNodeType() == Node.ELEMENT_NODE) 817 828 { … … 830 841 while (child != null) 831 842 { 843 // Again, need to first clear all empty text nodes (those containing space characters like \n,\r,\t and such) 844 // because the first while loop above would break out when it found an element node and wouldn't have got rid 845 // of all the empty text nodes yet. 846 // This time, beware not to delete the special end and start empty textnodes just added, since 847 // they've been created and inserted specifically. 848 if(child != endTextNode && child != startTextNode 849 && child.getNodeType() == Node.TEXT_NODE && child.getNodeValue().matches("^\\s*$")) 850 { 851 Node spaceTextNode = child; 852 child = child.getNextSibling(); 853 elem.removeChild(spaceTextNode); 854 855 if(child == null) break; 856 } 857 858 // go back to processing normal element nodes as intended 832 859 if (child.getNodeType() == Node.ELEMENT_NODE) 833 860 {
Note:
See TracChangeset
for help on using the changeset viewer.