易截截图软件、单文件、免安装、纯绿色、仅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">
......

使用Metadata简化表数据向XML形式转化的实现

使用Metadata简化表数据向XML形式转化的实现
如果需要将表数据转化为XML形式数据的话,如果我们使用Spring的JDBC Template,那么常需要做的工作是创建一个RowMapper匿名类,在其中将字段与领域对象的某个属性匹配上,然后得到领域对象链表形式的结果,此后展开这个集合,再将字段转化为XML数据,其中进行了两次名称和值之 ......

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 ......

Flex:ArrayCollection转xml形式的实例

ArrayCollection转成xml类型示例
下面模拟一组数据exams,将其转化为xml形式.详细代码见下:
Xml代码
<?xml version="1.0" encoding="utf-8"?>  
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" fontSize="12"  creationComplet ......

格式化XML:输出有缩进效果的XML字符串

1. 一般情况下使用以下代码即可将XML字符串重新格式化:
        private string FormatXml(string source)
        {
            StringBuilder  ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号