1 19 20 package edu.umd.cs.findbugs.xml; 21 22 import java.io.IOException ; 23 import java.util.Collection ; 24 import java.util.Iterator ; 25 26 32 public abstract class XMLOutputUtil { 33 41 public static void writeElementList(XMLOutput xmlOutput, String tagName, 42 Collection <String > listValues) throws IOException { 43 writeElementList(xmlOutput, tagName, listValues.iterator()); 44 } 45 46 54 public static void writeElementList(XMLOutput xmlOutput, String tagName, 55 Iterator <String > listValueIterator) throws IOException { 56 while (listValueIterator.hasNext()) { 57 xmlOutput.openTag(tagName); 58 xmlOutput.writeText(listValueIterator.next()); 59 xmlOutput.closeTag(tagName); 60 } 61 } 62 63 69 public static void writeCollection(XMLOutput xmlOutput, Collection <? extends XMLWriteable> collection) 70 throws IOException { 71 for (XMLWriteable obj : collection) { 72 obj.writeXML(xmlOutput); 73 } 74 } 75 } 76 77 | Popular Tags |