利用java Api解析XML
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/**
* Usage: You can get a instance of Document from a string of xml.
* This class supply some method to read a document.
*
*/
public class XMLParser {
/**
* Get a instance of Document from a string of xml.
*
* @param xmlStr
* @return Document
*/
public static Document parse(String xmlStr) {
if (xmlStr == null) {
return null;
}
StringReader reader = new StringReader(xmlStr);
InputSource source = new InputSource(reader);
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = null;
try {
builder = factory.newDocumentBuilder();
} catch (ParserConfigurationException e) {
e.printStackTrace();
}
if(builder == null){
return null;
}
Document doc = null;
try {
doc = builder.parse(source);
} catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return doc;
}
/**
* Get Item Value.
* @param node
* @return String
*/
public static String getItemValue(Node node){
String value = "";
if(node == null){
retur
相关文档:
接口中不可以定义构造方法
接口中只能有 public static final 的变量 和 public abstract 的方法,其它都不可以。
例如:
代码里是这样写的
public interface B{
StringBuilder sb=null;
void fun();
& ......
现在,谈云计算的可多了,不过,一般比较关注的是Google和Amazon的云服务。从大范围来看,也只有这两家获得了公众的更多关注。比如,我个人很感兴趣的,就是Google的App Engine使用户能够在Google基础设施上构建和托管 Web 应用程序。至于Amazon,它的AmazonWeb Services还包括Elastic Cloud Compute (EC2)计算Web服 ......
1.了解Java的原理:
首先要了解整个Java的大致结构、工作环境、历史。在这个过程中要搞明白Java从源代码到最后虚拟机里面执行的一个过程是怎样的。
2.学习Java语法:
Java里面只有50多个关键字和一些运算符。语法结构就只有顺序、条件、循环 ......
repaint 对组件进行重绘,比如一个panel,当你remove掉panel里面的一个组件时,你必须调用repaint方法才能对panel进行重绘,进行刷新,你想要删除的组件才能在界面上消失。
revalidate 对组件进行验证,比如一个panel,当你remove掉panel里面的一个组件时,当你调用revalidate方法后,panel的布 ......
1、 Web.xml
1) 配置hibernate
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/dbConnectionContext.xml /WEB-INF/serviceContext.xml</param-value> ......