Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Android£¨Èý£©Êý¾Ý´æ´¢Ö®XML½âÎö¼¼Êõ

½ñÈÕ¼ÌÐøѧϰAndroidÖÐʹÓÃPullµÄXML½âÎö¼¼ÊõʵÏÖ¶ÔXMLÎļþµÄ½âÎöºÍ´´½¨¡£ÓÉÓÚÃ÷ÌìÐÝÏ¢£¬Ê±¼ä±È½Ï³äÔ££¬ËùÒÔÎÒÒ²½«×òÌìδ×ܽáµÄSAX½âÎö¼¼ÊõÔÚ´Ë×ö¸ö×ܽᡣ
Ò»¡¢SAX½âÎö¼¼Êõ
SaxʹÓõÄÊÇʼþÇý¶¯µÄÁ÷ʽ½âÎö¼¼Êõ¡£Ê¼þÇý¶¯µÄÁ÷ʽ½âÎö·½Ê½ÊÇ£¬´ÓÎļþµÄ¿ªÊ¼Ë³Ðò½âÎöµ½ÎĵµµÄ½áÊø£¬²»¿ÉÔÝÍ£»òµ¹ÍË¡£µ±½âÎöµ½ÎĵµµÄ¿ªÊ¼»ò½áÊø¡¢ÔªËصĿªÊ¼»ò½áÊøµÈ¶¼»á´¥·¢Ò»¸öʼþ£¬ÎÒÃÇÔÚʼþ´¦Àí·½·¨ÖÐÍê³É¶ÔÊý¾ÝµÄ²Ù×÷¡£Óɴ˿ɼû£¬ÎÒÃÇÐèÒª±àдʵÏÖÁËʼþ½Ó¿ÚµÄÀà¡£
1.´´½¨Android¹¤³Ì(eclipse3.5)£º
Project name:AndroidXML
BuildTarget:Android2.1
Application name:Android XML ½âÎö¼¼Êõ
Package name:com.changcheng.androidxml
Create Activity:AndroidXML
Min SDK Version:7
2.ÐèÒª½âÎöµÄXMLÎļþ£º
"1.0" encoding="UTF-8"?>
"23">
C++ Primer 4
78
"20">
Think in Java
76
¸ÃÎļþ´æ·ÅÓÚsrcÔ´ÂëĿ¼¡£
3.XMLÎļþ¶ÔÓ¦µÄʵÌåBook£º
package com.changcheng.androidxml.entity;
public class Book {
private int id;
private String name;
private float price;
public Book() {
}
public Book(int id, String name, float price) {
this.id = id;
this.name = name;
this.price = price;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public float getPrice() {
return price;
}
public void setPrice(float price) {
this.price = price;
}
@Override
public String toString() {
return "Book [name=" + name + ", price=" + price + "]";
}
}
4.Sax½âÎöXMLµÄʼþ´¦ÀíÀࣺ
SaxµÄʼþ´¦ÀíÀà±ØÐëʵÏÖContentHandler½Ó¿Ú£¬µ«ÎÒÃÇÔÚÕâ¸öÀý×ÓÖв»ÐèҪʹÓõ½ContentHandler½Ó¿ÚµÄËùÓз½·¨£¬ÎÒÃǽöÐèÒªÆäÖеÄ3¸ö·½·¨¡£ËùÒÔSaxΪÎÒÃÇÌṩÁËÒ»¸öûÓнøÐÐÈκβÙ×÷µÄContentHandlerʵÏÖÀàDefaultHandler¡£ÎÒÃÇÖ±½Ó¼Ì³ÐDefaultHandlerÀ࣬²¢ÖØдÎÒÃÇÐèÒªµÄ·½·¨¼´¿É¡£
package com.changcheng.androidxml.xml;
import java.util.ArrayList;
import java.util.List;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
import com.changcheng.androidxml.entity.Book;
public class SaxXmlCont


Ïà¹ØÎĵµ£º

Õë¶Ô¸Ã¼Ü¹¹½øÐеĹ淶XMLÑé֤ʧ°Ü

ÔÚAccess2007ÖдÓExcelµ¼Èëʱ£¬¾­³£»áÅöµ½ÈçϵĴíÎóÌáʾ£º“Õë¶Ô¸Ã¼Ü¹¹½øÐеĹ淶XMLÑé֤ʧ°Ü¡£ÒÔÏÂXMLÎĵµÐÐÖдæÔÚ´íÎ󣺣ü¡£”
ÎҵĽâ¾ö·½Ê½ÊÇÓÃÁ´½Ó±í·½Ê½À´´ò¿ªExcelÎļþ£¬È»ºóÔÚ¸´ÖÆÁ´½Ó±í£¬Õ³Ìù¡£ ......

ÊÕµ½µÄXMLת³ÉdatasetÐÍ

 /// <summary>
        /// ÊÕµ½µÄXMLת³ÉdatasetÐÍ
        /// </summary>
        /// <param name="xmlData"></param>
        /// ......

XML Íêȫѧϰ½Ì³Ì


ʲôÊÇ XML?
XML Ö¸¿ÉÀ©Õ¹±ê¼ÇÓïÑÔ£¨EXtensible Markup Language£©
XML ÊÇÒ»ÖÖ±ê¼ÇÓïÑÔ£¬ºÜÀàËÆ HTML
XML µÄÉè¼Æ×ÚÖ¼ÊÇ´«ÊäÊý¾Ý£¬¶ø·ÇÏÔʾÊý¾Ý
XML ±êǩûÓб»Ô¤¶¨Òå¡£ÄúÐèÒª×ÔÐж¨Òå±êÇ©¡£
XML ±»Éè¼ÆΪ¾ßÓÐ×ÔÎÒÃèÊöÐÔ¡£
XML ÊÇ W3C µÄÍƼö±ê×¼
XML Óë HTML µÄÖ÷Òª²îÒì
XML ²»ÊÇ HTML µÄÌæ´ú¡£
XML ºÍ HTML Ϊ² ......

Struts2Êä³öXML¸ñʽµÄResult

À©Õ¹Struts2--×Ô¶¨ÒåStringºÍXML¸ñʽµÄResult 



struts2ËäÈ»¼Ì³ÐÁËwebworkÓÅÐãµÄMVC·ÖÀ룬¿ÉÊÇÓкܶàµØ·½ÈÃÈË°Ù˼²»µÃÆä½â£¡×îÈÃÈËÀëÆ×µÄÊÇ£¬·µ»ØµÄ½á¹û¼¯ÖоÓȻûÓÐ
String£¬xmlÕâÁ½Öַdz£³£ÓõÄÀàÐÍ¡£»¹ÊÇ×Ô¼º¶¯ÊÖ£¬·áÒÂ×ãʳ£º
µÚÒ»ÖÖ·½Ê½£ºÊ¹ÓÓPlainText Result”
 & ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ