dom4j 读 xml 文件
<?xml version="1.0" encoding="UTF-8"?>
<company>
<tel>020-12345678-66</tel>
<tel>020-12345678-85</tel>
<introduce>
<![CDATA[
<br/><h1>公司简介</h1>
]]>
</introduce>
</company>
2.用dom4j 读,
package cn.rentbus;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
//import java.io.FileWriter;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import junit.framework.TestCase;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.Node;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.SAXReader;
import org.dom4j.io.XMLWriter;
public class Dom4jXmlTest extends TestCase {
protected final Log logger = LogFactory.getLog(getClass());
private SAXReader reader;
private Document document;
private File xmlFile;
protected void setUp() throws Exception {
xmlFile = new File("WEB-INF/company.xml");
reader = new SAXReader();
document = reader.read(xmlFile);
}
protected void tearDown() throws Exception {
super.tearDown();
&n
相关文档:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Xml;
namespace jiu ......
<package name="struts" extends="struts-default">
<!-- class 为该action实现的类 -->
<action name="login" class="struts2.loginaction">
......
Flex 和C++ 之间传输结构体数据
一直想试验用结构体传数据
但是Flex 和C++ 的类型所占的字节数有时不一样
如int 在C++中站2个字节,而在Flex中占4个字节。
转换比较麻烦。
最后决定用XML进行传输
然后两边都加一个XML 解析和封装类。
C++ 端使用的tinyXML 类
Flex直接使用自己带的 E4X 类
Flex代码如下
&nb ......
本文共两个文件:translate.mxml 和 mapmarking.xml
1、translate.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="librar ......