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

XML读取

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
public class XMLReader {
public static List<File> fileList = null;
public static List<String> startWidth = null;
public static void main(String[] args) throws Exception {
File root = new File("xml");
File[] files = root.listFiles();
fileList = Arrays.asList(files);
SAXReader reader = new SAXReader();
for (File file : fileList) {
Document document = reader.read(file);
startTest(document, file);
}
System.out.println("------------ end ------------");
}
public static void startTest(Document document, File file) {
if (!startWithSE(document, file))
return;
if (!isN(document, file))
return;
if (!isNGBOrTenNumber(document, file))
return;
if (!startWithNGBS(document, file))
return;
if (!hasNode(document, file))
return;
if (!notZero(document, file))
return;
}
/*
* /FMS/SEA_OBL/JOB_NO 以SE开始
*
*/
public static boolean startWithSE(Document document, File file) {
String path = "/FMS/SEA_OBL/JOB_NO";
List list1 = document.selectNodes(path);
String text = null;
for (Element tel : (List<Element>) list1) {
text = tel.getTextTrim();
if (!text.startsWith("SE")) {
// fileList.remove(file);
System.out.println(file.getName() + " " + path
+ " not startWithSE");
copyFiles( file);
return false;
}
}
return true;
}
// /FMS/SEA_OBL/NORMAL_DIRECT 为N
public static boolean isN(Document document, File file) {
String path = "/FMS/SEA_OBL/NORMAL_DIRECT";
List list1 = document.selectNodes(path);
String text = null;
for (Element tel : (List<Element>) list1) {
text = tel.getTextTrim();
if (!text.equals("N")) {
// fileList.remove(file);
S


相关文档:

用jdom来解析xml文件

xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<mobile-list>
<mobile type="Nokia2652">
<wap2>false</wap2>
<width>115</width>
</mobile>
<mobile type="Nokia2650">
......

用Dom4j来解析xml文件

package com.pk.xml;
import java.io.File;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
public class Dom4j {
public static void main(String[] args) {
try {
//获得SAX解析器
SAXReader reader = new SAXReader();

//解析文件
File file = n ......

ASP.NET 演练:创建网页以显示 XML 数据


数据通常是以 XML 格式提供给 Web 应用程序的。但是,XML 数据本质上是分层的,因此您可能希望能够在基于列表的控件中使用 XML 数据,如 GridView 或 DropDownList 控件。此演练演示如何将 XML 数据视为表格数据库表中的数据进行处理。
 
通过此演练,您将学会如何执行以下任务:
·使用数据源控件读取 XM ......

php之XML转数组函数

<?
/**
* xml2array() will convert the given XML text to an array in the XML structure.
* Link: http://www.bin-co.com/php/scripts/xml2array/
* Arguments : $contents - The XML text
* $get_attributes - 1 or 0. If this is 1 the function will get the attributes as well as the ......

python minidom 写xml示例

以下是一个通过minidom模块写文件的完整示例,是在最近做的项目Walle上面用到的,这个示例的目的是生成一个如下的格式的xml,文件格式为无BOM utf-8。
生成xml文件格式:
<?xml version="1.0" encoding="utf-8"?> 
<coverages> 
    <coverage> 
    ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号