import java.io.InputStream; import java.io.FileInputStream; import java.io.File; import org.w3c.dom.Document; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilder; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class ExternalRef{ private String basePath; public ExternalRef(){ } public String getRef(String file, String lang, String targettype, String id){ getPath(); try{ String tfile = file+"_"+lang+".xml"; String path = basePath + "/xml-source/" + lang + "/" + tfile; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder domBuilder = factory.newDocumentBuilder(); InputStream is = new FileInputStream(path); Document doc = domBuilder.parse(is); NodeList list = doc.getElementsByTagName(targettype); int i=0; for(i=0; i