package abc;import java.io.IOException;import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;public class TransXML {
private static TransXML xmlInstance;private Element ipConfig;
private TransXML(String xmlPath)
{    SAXBuilder builder=new SAXBuilder(false);
     try {
    
Document doc=builder.build(xmlPath);
ipConfig=doc.getRootElement();
} catch (JDOMException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public String getIpConfig(String configName)
{

return ipConfig.getChild(configName).getText();

}
public static synchronized TransXML getInstance(String xmlPath)
{
if(xmlInstance==null)
{xmlInstance=new TransXML(xmlPath);}
return xmlInstance;
}}
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
IPConfig.xml
<ipconfig>
<ftpserver>192.168.1.254</ftpserver>
<ftpport>21</ftpport>
<ftpuser>zyt</ftpuser>
<ftpswd>zyt</ftpswd><filepath>/webapps/weatherreport/uploadpic/</filepath><dbfilepath>W://姣忔棩鍗瑙嗛//</dbfilepath>
</ipconfig>