In the B / S structural-based system developed by Java, some configurations are often placed in an XML file and then take parameters in this file, which reduces the situation of Hard Code. The following class is used to parse the XML file. Specifically use the write method of the reference main method.
/ ** * filename: xmlprocess.java * Description: XML file resolution * Date: 2004-12-07 * @Author sunlen * * History: // History modification record *
Import org.w3c.dom. *; import javax.xml.parsers. *; import java.io. *; import java.util. *; import orom.xml.sax. *; import java.net. *;
Public class xmlprocess {
/ ** XML parser factory. * / Private static documentbuilderfactory factory;
/ ** XML parser. * / Private static documentbuilder builder;
/ ** xml head. * / Private static final string xml_head = " XML Version = /" 1.0 / "encoding = /" GB2312 / "?>
/ ** indent prefix. * / Private static string indent = ""
Ayuan
9CBS certified blog expert
Blog expert
Huawei old employees
Big Data
More than ten years, in Huawei, Internet Corporation's experience, profound understanding and practical experience in CRM, big data, mainly sharing various project experience, including architecture, Java, big data and other articles