java 将EXCEL表格数据转换成XML格式
有时候我门需要把EXCEL表格中的数据转换成XML格式 这需要用到JXL(分析EXCEL)包和JDOM包(构成XML)
import java.io.*;
import jxl.*;
import org.jdom.Element;
import org.jdom.Document;
import org.jdom.output.XMLOutputter;
/**
*
* @author guo
*/
public class EtoX {
/** Creates a new instance of EtoX */
public EtoX() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
try{
InputStream is= new FileInputStream("C:\\Documents and Settings\\guo\\EXCELtoXML\\src\\exceltoxml\\ningxia.xls");
Workbook rwb=Workbook.getWorkbook(is);
//System.out.println(rwb.getNumberOfSheets()); //获得工作薄(Workbook)中工作表(Sheet)的个数
Sheet rs=rwb.getSheet(0);
int l=rs.getColumns(); //返回表中的总列数
int w=rs.getRows(); //返回表中包含总行数
System.out.println("文件总共"+w+"行");
Element root=new Element("allmetadata");
Document doc=new Document(root);
相关文档:
Here is a simple library to query Google Maps with the following features:
geocode addresses to their geographic coordinates
retrieve static images with given custom size, format and zoom
To see a live sample of this API, you can check here: Java ME Google Maps API sample MIDlet
Contents
[h ......
JAVA操作XML的完整例子——W3C DOM
JAVA操作XML的完整例子——W3C DOM篇收藏
这是一个用JAVA W3C DOM 进行XML操作的例子,包含了查询、增加、修改、删除、保存的基本操作。较完整的描述了一个XML的整个操作流程。适合刚入门JAVA XML操作的朋友参考和学习。
假设有XML文件:test1.xml
<?xml v ......
package com.navinfo.mygim.admin.util;
/*
* Pinyin.java
* vicbay
*/
public class Pinyin{
private String[] name = { "zuo", "zun", "zui", "zuan", "zu", "zou",
"zong", ......
Spring Framework 【Java开源 J2EE框架】
Spring是一个解决了许多在J2EE开发中常见的问题的强大框架。 Spring提供了管理业务对象的一致方法并且鼓励了注入对接口编程而不是对类编程的良好习惯。Spring的架构基础是基于使用JavaBean属性的Inversion of Control容器。然而,这仅仅是完整图景中的一部分:Spring在使用IoC容器 ......