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
Ïà¹ØÎĵµ£º
// MsXmlTest.cpp : ¶¨Òå¿ØÖÆ̨ӦÓóÌÐòµÄÈë¿Úµã¡£
//
#include "stdafx.h"
#include "MsXmlTest.h"
#include <clocale>
#include "comutil.h"
#import "msxml4.dll"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// ΨһµÄÓ¦ÓóÌÐò¶ÔÏó
CWinApp theApp;
using namespace std;
void WritePerson(MSXML2: ......
1. Jaxp ½âÎöxmlÎļþ Dom·½Ê½
<?xml version="1.0" encoding="gbk"?>
<students>
<student id="001">
<name>ÕÅÈý</name>
<age>25</age>
</student>
<student id="002">
<name>ÀîËÄ</name>
& ......
Ñо¿E4XÓëFlexµÄ¹Øϵ£¬ËùÒÔ´òËã×ܽáһϣ¬ÓÐ˵µÄ²»¶ÔµÄµØ·½£¬»¹Çë´ó¼Ò¶à¶àÔÁ¡£
Ò»¡¢×î¼òµ¥Ä£Ê½£ºFlexͨ¹ýhttpserviceºÍdataProvider½øÐÐÊý¾Ý´«Êä
Xml¸ñʽÈçÏ£º
<?xml version="1.0" encoding="utf-8" ?>
<Result>
<NodeA>value1</NodeA>
<NodeB>valve2</NodeB>
…&he ......
ÔÚJ2MEÌåϵÖУ¬¶ÔxmlµÄ½âÎöÓбȽÏÓÐÃûµÄµÚÈý·½½âÎöAPI£¬·Ö±ðΪKXMLºÍNanoXML£¬ËûÃǶ¼ÌṩÁ˶ԽâÎöxmlµÄÖ§³Ö¡£KXMLÔÚ½âÎöXML¹ý³ÌÖлá¶ÔÎļþÄÚÈÝÒ»²ãÒ»²ã½øÐнâÎö£¬Òò´Ë³ÉΪÔöÁ¿Ê½½âÎöÆ÷£¬±È½ÏÊʺϴóÎļþµÄ½âÎö¡£¶øNanoXMLÊÇÒ»´ÎÐÔ½âÎöÆ÷£¬ÔÚÒ»´Îʱ¼äÀï¾Í°ÑÕû¸öxmlÎĵµ½âÎöÍ꣬Òò´Ë²»ÊʺϴóÎļþµÄ½âÎö£¬»áÔì³ÉÄÚ´æ²»×ãµÄÏÖÏó¡ ......