易截截图软件、单文件、免安装、纯绿色、仅160KB

java SAX解析XML文件

import java.io.File;
import java.io.FileNotFoundException;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
public class ResolveXmlFile {
 
 public void resolverXml() throws DocumentException, FileNotFoundException{
  
  //读取xml文件 来得到document
  SAXReader reader = new SAXReader();
  Document document = reader.read(new File("F:\\Workspaces\\DomXmlProject\\src\\T_AR_OtherBillentry.xml"));
  Element root = document.getRootElement();
  //循环根节点
  for(java.util.Iterator it =root.elementIterator("columns");it.hasNext();){
    Element elm=(Element)it.next();
    
    //循环子节点
    for(java.util.Iterator it1 = elm.elementIterator("column");it1.hasNext();){
     Element elm1 =(Element)it1.next();
     Element name=elm1.element("name");              //取得节点
     Element type=elm1.element("sqlType");   //取得节点
     System.out.println(name.getData().toString()+type.getData().toString());
    }
   }
 }
 
 public static void main(String[] args) throws DocumentException, FileNotFoundException{
  ResolveXmlFile rx = new ResolveXmlFile();
  rx.resolverXml();
 }
}


相关文档:

Java中集合容器类List和Set的用法

List的用法
List包括List接口以及List接口的所有实现类。因为List接口实现了Collection接口,所以List接口拥有Collection接口提供的所有常用方法,又因为List是列表类型,所以List接口还提供了一些适合于自身的常用方法,如表1所示。
表1  List接口定义的常用方法及功能
从表1可以看出,List接口提供的适合于自身的 ......

JNA实现Java调用Fortran

在成功实现Java调用C++之后,接下来想到能否通过JNA实现Java调用Fortran,今天试验了一下,还是比较容易的。
网上有一个Java调用F95的例子,但是我考虑不仅要实现F95的调用,还要实现F77的调用,所以费了一些周折。
问题的关键在于F77为过程名自动添加了一个尾部的下划线,所以sub1这个过程,到Java一端,就变成了sub1_, ......

java继承问题 经常遇到保存下来

import java.util.ArrayList;
import java.util.HashMap;

public class Client {

/**
* @param args
*/
public static void main(String[] args) {
test1();
System.out.println("==================================");
test2(); ......

java 集合

< type="text/javascript"> document.body.oncopy = function() { if (window.clipboardData) { setTimeout(function() { var text = clipboardData.getData("text"); if (text && text.length>300) { text = text + "\r\n\n本文来自CSDN博客,转载请标明出处:" + location.href; clipboardData.setData( ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号