Java tutorial
//package com.java2s; import java.util.List; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Text; public class Main { public static void encodeStringList(Document doc, Element parent, List<String> list, String namespaceURI, String qualifiedName) { Element currElm; Text currVal; if (list != null) { for (String item : list) { currElm = doc.createElementNS(namespaceURI, qualifiedName); currVal = doc.createTextNode(item); currElm.appendChild(currVal); parent.appendChild(currElm); } } } }