ÓÃJDOM¶ÁÈ¡XMLÎļþ
ǰÌ᣺1.JdomµÄ¼Ü¹¹ÒѾµ¼Èë
²½Ö裺
ÓÃJDOM¶ÁÈ¡XMLÎļþÐèÏÈÓÃorg.jdom.input.SAXBuilder¶ÔÏóµÄbuild()·½·¨´´½¨Document¶ÔÏó,
È»ºóÓÃDocumentÀà¡¢ElementÀàµÈµÄ·½·¨¶ÁÈ¡ËùÐèµÄÄÚÈÝ¡£
<?xml version="1.0" encoding="UTF-8"?>
<HD>
<disk name="C">
<capacity>8G</capacity>
<directories>200</directories>
<files>1580</files>
</disk>
<disk name="D">
<capacity>10G</capacity>
<directories>500</directories>
<files>3000</files>
</disk>
</HD>
ÉÏÃæµÄsample.xmlÎĵµ£¬ÃèÊöÁËij̨µçÄÔÖÐÓ²Å̵Ļù±¾ÐÅÏ¢(¸ù½Úµã<HD>´ú±íÓ²ÅÌ£¬<disk>±êÇ©´ú±íÓ²ÅÌ·ÖÇø£¬
´ÓËüµÄnameÊôÐÔ¿ÉÒÔ¿´³öÓÐÁ½¸öÅÌ·ûÃû³ÆÎª"C"ºÍ"D"µÄ·ÖÇø£»Ã¿¸ö·ÖÇøÏ¶¼°üº¬<capacity>,<directories><files>Èý¸ö½Úµã£¬
·Ö±ð´ú±íÁË·ÖÇøµÄ¿Õ¼ä´óС¡¢Ä¿Â¼ÊýÁ¿¡¢Ëùº¬Îļþ¸öÊý)
ÏÂÃæµÄ³ÌÐò¶ÁÈ¡´ËÎļþÖеÄÐÅÏ¢£º
import java.util.*;
import org.jdom.*;
import org.jdom.input.SAXBuilder;
public class Sample1 {
public static void main(String[] args) throws Exception{
SAXBuilder sb=new SAXBuilder();
Document doc=sb.build("sample.xml"); //¹¹ÔìÎĵµ¶ÔÏó
Element root=doc.getRootElement(); //»ñÈ¡¸ùÔªËØ
List list=root.getChildren("disk"); //È¡Ãû×ÖΪdiskµÄËùÓÐÔªËØ
for(int i=0;i<list.size();i++){
Element element=(Element)list.get(i); //»ñÈ¡µÚi¸öÔªËØ
String name=element.getAttributeValue("name"); //»ñÈ¡ÊôÐÔ
String capacity=element.getChildText("capacity"); //È¡disk×ÓÔªËØcapacityµÄÄÚÈÝ
&
Ïà¹ØÎĵµ£º
function $import(path,type,title,idname){
var s,i;
if(type=="js"){
&nb ......
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath(NetShop.Config.DbConfigs.GetSitePath + "images/flashdata/flash.config"));
DataRow[] drs = ds.Tables[0].Select("", "[SortOrder] ASC");
//·µ»ØµÄÊǸöDataRow[]£º
//DataR ......
Paul.Todd | 09 April, 2007 15:24
I have noticed a couple of people seem to be having problems with using the XML parser in Symbian and there are no examples outside of the devkit. The parser I will be talking about is the xml one, not the one SOAP engine as the SOAP one is Nokia specific.
The ke ......
[Bug 230608] missing config.h in latest -14
Ralf Corsepius rc040203 at freenet.de
Tue Mar 6 13:31:13 UTC 2007
Previous message: [Bug 230608] missing config.h in latest -14
Next message: [Bug 230608] missing config.h in latest -14
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] ......
.NET¶Á¡¢Ð´¡¢²é¡¢É¾¡¢¸ÄXMLÎļþ
Ò»¡¢
XML
¼ò½é
XML
¼´¿ÉÀ©Õ¹±ê¼ÇÓïÑÔ£¨
EXtensible Markup Language
£©£¬ÊÇÒ»ÖÖ±ê¼ÇÓïÑÔ£¬ºÜÀàËÆ
HTML
¡£
XML
µÄÉè¼Æ×ÚÖ¼ÊÇ´«ÊäÊý¾Ý£¬¶ø·ÇÏÔʾÊý¾Ý¡£
XML
±êǩûÓб»Ô¤¶¨Ò壬ÐèÒªÓû§¶¨Òå±êÇ©¡£
XML
±»Éè¼ÆÎª¾ßÓÐ×ÔÎÒÃèÊöÐÔ²¢·ûºÏ
W3C
µÄÍÆ¼ö± ......