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
相关文档:
使用VS2005工具XSD.exe(SDK\v2.0\Bin\xsd.exe)自动生成实体类:
xsd /c /namespace:myCompany /language:CS temp1.xsd
也可以生成DataSet类型的类:
xsd /dataset /language:CS temp1.xsd
( 类文件和XSD之间可以相互转换,也就是说,你也可以先生成类,然后自动生成XSD)
自动读取XML数据 ......
Integration with the XML Data Type
With the introduction of the XML data type, we wanted to also give FOR XML the ability to generate an instance of XML directly (more precisely, it generates a single row, single column rowset where the cell contains the XML data type instance).
Because of the bac ......
protected void btn_write_Click(object sender, EventArgs e)
{
XmlWriterSettings settings=new XmlWriterSettings();
settings.Indent=true;
setting ......
本文共两个文件: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 ......