xml½âÎö
xml
<mime>
<content>
<type>text/plain</type>
<big>357</big>
<text>D:\\cybercourttext2009101410241364.txt</text>
</content>
<content>
<type>text/plain</type>
<big>357</big>
<text>D:\\cybercourttext2009101410241364.txt</text>
</content>
</mime>
½âÎö
XmlDocument myDoc = new XmlDocument();
myDoc.LoadXml(xmlcontent);
//ËÑË÷Ö¸¶¨µÄ½Úµã
System.Xml.XmlNodeList mimenodes = myDoc.SelectNodes("//content");
for (int i = 0; i < mimenodes.Count; i++)
{
string type = mimenodes[i].FirstChild.InnerText;//»ñÈ¡contentϵĵÚÒ»¸ö½Úµã
string text = mimenodes[i].LastChild.InnerText;//»ñÈ¡contentϵÄ×îºóÒ»¸ö½Úµã
}
Ïà¹ØÎĵµ£º
1¡¢°²×°DOM4j
http://www.dom4j.org/
2¡¢°²×°jaxen
http://jaxen.org/releases.html
3¡¢´úÂë
package extract;
import java.io.*;
import org.dom4j.*;
import org.dom4j.io.*;
import java.util.*;
public class XmlExtract {
private SAXReader reader;
private Docum ......
/// <summary>
/// Ö§³ÖXMLÐòÁл¯µÄ·ºÐÍ Dictionary
/// </summary>
/// <typeparam name="TKey"></typeparam>
/// <typeparam name="TValue"></typeparam>
[XmlRoot("SerializableDictionary")]
public class SerializableDictionary<TKey, TValue& ......
ʹÓÃdom4j½âÎöXMLʱ£¬Òª¿ìËÙ»ñȡij¸ö½ÚµãµÄÊý¾Ý£¬Ê¹ÓÃXPathÊǸö²»´íµÄ·½·¨£¬dom4jµÄ¿ìËÙÊÖ²áÀïÒ²½¨ÒéʹÓÃÕâÖÖ·½Ê½£¬±êÌⶼдµÄÕâôÀ«Æø£ºPowerful Navigation with XPath£¬ºÇºÇ¡£
·½·¨ÊÇʹÓÃDocumentµÄselectNodes(String XPath)·½·¨£¬´úÂëд·¨£º
List l = doc.selectNodes("//COLS/COL1");
Ö´ÐÐʱȴÅ׳öÒÔÏÂÒì³££º
Exc ......
SAX¸ÅÄî
SAXÊÇSimple API for XML
µÄËõд£¬Ëü²¢²»ÊÇÓÉW3C¹Ù·½ËùÌá³öµÄ±ê×¼£¬¿ÉÒÔ˵ÊÇ“Ãñ¼ä”µÄÊÂʵ±ê×¼¡£Êµ¼ÊÉÏ£¬ËüÊÇÒ»ÖÖÉçÇøÐÔÖʵÄÌÖÂÛ²úÎï¡£ËäÈ»Èç´Ë£¬ÔÚXMLÖжÔSAXµÄÓ¦ÓÃË¿ºÁ²»±ÈDOMÉÙ£¬¼¸ºõËùÓеÄXML½âÎöÆ÷¶¼»áÖ§³ÖËü¡£
Óë
DOM±È½Ï¶øÑÔ£¬SAXÊÇÒ»ÖÖÇáÁ¿Ð͵ķ½·¨¡£ÎÒÃÇÖªµÀ£¬ÔÚ´¦ÀíDOMµÄʱºò£¬Î ......
¼òµ¥µØËµ£¬xslÊÇ˵Ã÷xmlÈçºÎ±í´ï³öÀ´µÄÑùʽÎļþ£¬¶øxsd¸ø³öxmlÎļþµÄ¸ñʽÃèÊö
Èç¹û˵xmlÊÇÒ»µþ³®Æ±£¬xsd¾ÍÊÇÑé³®»ú£¬¿´¿´ÀïÃæÓÐûÓмٳ®£¬¶øxslÊǵ㳮»ú£¬¿´¿´µ½µ×ÊǶàÉÙÇ®¡£ÓÃxml¿ÉÒÔ²»ÓÃxsd£¬¾ÍÏñ»¨Ç®µÄʱºò²»Ò»¶¨ÒªÑé³®Ò»Ñù£¬µ«ÊÇÊÕÇ®µÄÈËÒ»°ãÊÇÏëÒªÑéµÄ¡£¶ø»¨Ç®µÄʱºò²»Äܲ»µã³®£¬²»µãÄǾͲ»ÊÇ»¨Ç®ÁË£¬ÊÇÍæÇ®¡£µ±È»ÁË£ ......