java ¶ÔxmlµÄÔöɾ¸Ä²é
<?xml version="1.0" encoding="UTF-8"?>
<root>
<person id="1">
<username >xiaoma</username>
<password>xiaoma</password>
</person>
<person id="2">
<username>manager</username>
<password>password2</password>
</person>
<person id="3">
<username>hello</username>
<password>woerld</password>
</person>
</root>
*****************************
package com.test;
import java.io.*;
import java.util.*;
import org.jdom.*;
import org.jdom.input.SAXBuilder;
import org.jdom.output.XMLOutputter;
/**
* xmlµÄÔöɾ¸Ä²éÖ®SAXBuilder
*
* @author Administrator
*
*/
public class XmlTest {
// ²éѯËùÓеÄÊý¾Ý
public static void list() throws JDOMException, IOException {
SAXBuilder builder = new SAXBuilder();
String xmlPath = "message.xml";
// String xmlPath = "./WebRoot/xml/message.xml";
// »ñµÃÎĵµ¶ÔÏó
Document document = builder.build(xmlPath);
// »ñµÃ¸ù½Úµã
Element root = document.getRootElement();
List list = root.getChildren();
System.out.println("root : " + root);
System.out.println("root.getName : " + root.getName());
System.out.println("listSize : " + list.size());
Iterator it = list.iterator();
while (it.hasNext()) {
Element e = (Element) it.next();
System.out.println("ID: " + e.getAttributeValue("id"));
System.out.println("childUsername:" + e.getChildText("username"));
System.out.println("childPassword:" + e.getChildText("password"));
}
// for(int i=0;i<list.size();i++){
// Element e = (Element)list.get(i
Ïà¹ØÎĵµ£º
ÀàµÄ³õʼ»¯ºÍ¶ÔÏó³õʼ»¯ÊÇ JVM ¹ÜÀíµÄÀàÐÍÉúÃüÖÜÆÚÖзdz£ÖØÒªµÄÁ½¸ö»·½Ú£¬Google ÁËÒ»±éÍøÂ磬ÓйØÀà×°ÔØ»úÖƵÄÎÄÕµ¹ÊDz»ÉÙ£¬È»¶øÀà³õʼ»¯ºÍ¶ÔÏó³õʼ»¯µÄÎÄÕ²¢²»¶à£¬ÌرðÊÇ´Ó×Ö½ÚÂëºÍ JVM ²ã´ÎÀ´·ÖÎöµÄÎÄÕ¸üÊÇÏÊÓÐËù¼û¡£
±¾ÎÄÖ÷Òª¶ÔÀàºÍ¶ÔÏó³õʼ»¯È«¹ý³Ì½øÐзÖÎö£¬Í¨¹ýÒ»¸öʵ¼ÊÎÊÌâÒýÈ룬½«Ô´´úÂëת»»³É JVM ×Ö½ÚÂëºó£¬ ......
Ò»¡¢JAVAÀ¬»ø»ØÊÕ»úÖƸÅÊö
ÔÚVB¡¢C++µÈijЩ³ÌÐòÉè¼ÆÓïÑÔÖУ¬ÎÞÂÛÊǶÔÏó»¹ÊǶ¯Ì¬ÅäÖõÄ×ÊÔ´»òÄڴ棬¶¼±ØÐëÓɳÌÐòÔ±×ÔÐÐÉùÃ÷²úÉúºÍ»ØÊÕ£¬·ñÔòÆäÖеÄ×ÊÔ´½«²»¶ÏÏûºÄ£¬Ôì³É×ÊÔ´µÄÀË·ÑÉõÖÁËÀ»ú¡£ÓÉÓÚÒªÔ¤ÏÈÈ·¶¨Õ¼ÓõÄÄÚ´æ¿Õ¼äÊÇ·ñÓ¦¸Ã±»»ØÊÕÊǷdz£À§Äѵģ¬Õâ¾Íµ¼ÖÂÊÖ¹¤»ØÊÕÄÚ´æÍùÍùÊÇÒ»ÏÔÓ¶ø¼è¾ÞµÄ¹¤×÷¡£Òò´Ë£¬µ±Ê¹ÓÃÕâЩ³ÌÐ ......
2009-12-20 22:15:02
½ñÌ컨ÁËÒ»Ììʱ¼ä°Ñ´«ÖDz¥¿ÍµÄJAVA SE¸ß¼¶ÊÓƵ1 API¿´ÍêÁË£¬»¹¿´ÁËÒ»²¿·Ö¸ß¼¶Ê³Æ·2 IOµÄÊÓƵ£¬ÒÔÏÂÊÇAPIµÄ±Ê¼Ç¡£
API: Application Programming Interface Ó¦ÓóÌÐò±à³Ì½Ó¿Ú
windows API£ºwindowsϵͳÌṩµÄ
JAVA API£ºJDKÖÐÌṩµÄ¸÷ÖÖjavaÀà(ÕÆÎÕ³£ÓõÄAPI ......
1.³éÏ󣺡¡³éÏó¾ÍÊǺöÂÔÒ»¸öÖ÷ÌâÖÐÓ뵱ǰĿ±êÎ޹صÄÄÇЩ·½Ã棬ÒÔ±ã¸ü³ä·ÖµØ×¢ÒâÓ뵱ǰĿ±êÓйصķ½Ãæ¡£³éÏó²¢²»´òËãÁ˽âÈ«²¿ÎÊÌ⣬¶øÖ»ÊÇÑ¡ÔñÆäÖеÄÒ»²¿·Ö£¬ÔÝʱ²»Óò¿·Öϸ½Ú¡£³éÏó°üÀ¨Á½¸ö·½Ã棬һÊǹý³Ì³éÏ󣬶þÊÇÊý¾Ý³éÏó¡£
2.¼Ì³Ð£º
¡¡¼Ì³ÐÊÇÒ»ÖÖÁª½áÀàµÄ²ã´ÎÄ£ÐÍ£¬²¢ÇÒÔÊÐíºÍ¹ÄÀøÀàµÄÖØÓã¬ËüÌṩÁËÒ»Ö ......