ÓÃDom4jÀ´½âÎöxmlÎļþ
package com.pk.xml;
import java.io.File;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
public class Dom4j {
public static void main(String[] args) {
try {
//»ñµÃSAX½âÎöÆ÷
SAXReader reader = new SAXReader();
//½âÎöÎļþ
File file = new File("D:\\ÏîÄ¿\\me\\mobilelist.xml");
Document document = reader.read(file);
//»ñÈ¡¸ú½Úµã
Element root = document.getRootElement();
//»ñµÃ×Ó½ÚµãÁбí
for(int i = 0 ; i<root.nodeCount();i++){
//È¡µÃijһ¸ö×Ó½Úµã
Element book = (Element) root.node(i);
//È¡µÃÊôÐÔÖµ
String type = book.attributeValue("type");
System.out.print(type+"\t");
String wap2 = book.node(0).getText();
String wedint = book.node(1).getText();
System.out.print(wap2+"\t");
System.out.println(wedint+"\t");
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
Ïà¹ØÎĵµ£º
Internet Explorer 5.0 ¶Ô XML ÌṩÄĸö¼¶±ðµÄÖ§³Ö£¿
¡¡¡¡Internet Explorer 5 ÌṩÏÂÁÐ XML Ö§³Ö£º
¡¡¡¡Ö±½Ó²é¿´ XML¡£Microsoft XML ʵÏÖÔÊÐíÓû§Í¨¹ýËûÃÇµÄ Web ä¯ÀÀÆ÷ʹÓà XSL »òÕß²ãµþÑùʽ±í (CSS) ²é¿´ XML£¬¾ÍÏó²é¿´ HTML ÎĵµÒ»Ñù¡£
¡¡¡¡¸ßÐÔÄÜ¡¢ÑéÖ¤ XML ÒýÇæ¡£Internet Explorer 4.0 ¿ª·¢ÈËÔ±ÊìϤµÄ XML ÒýÇ ......
HTML.htmlÎļþ
<div align="center" class="style1">
<p>±ù¹÷Áбí</p>
<p></p>
<table width="400" border="1">
<tr>
<th scope="col"><font size="4">Æ·ÅÆ</font></th> ......
ÉùÃ÷
/// <summary>
/// XMLÎĵµ
/// </summary>
XmlDocument xmldoc;
&n ......
´óÁ¿SmipleXMLº¯Êý¿ÉÓÃÀ´¼ÓÔØºÍ½âÎö´óÁ¿XMLÎĵµ¡£
1.simpleXML_load_file()º¯ÊýÀ´¼ÓÔØÖ¸¶¨µÄXMLÎļþµ½¶ÔÏó¡£Èç¹û¼ÓÔØÎļþʱÓöµ½ÎÊÌ⣬Ôò·µ»ØFLASE¡£Àý£º
book.xmlÎļþ£º
<?xml version="1.0" standalone="yes"?>
<library>
<book>
<title>Pride and Prejudice</title>
< ......