Document½âÎöxmlÓöµ½µÄÎÊÌâ~~ - Òƶ¯Æ½Ì¨ / Android
XMLÎļþÄÚÈÝ£º
- <ResList>
<page>0</page>
- <resItem>
<resName>WWW</resName>
</resItem>
- <resItem>
<resName>DDD</resName>
</resItem>
</ResList>
½âÎö·½·¨£º
public void parseData(){
videoInfo = new LiveVideoInfo();
Element root = mDocument.getDocumentElement();
NodeList page = root.getElementsByTagName("page");
videoInfo.setCurrentPage(Integer.parseInt(page.item(0).getFirstChild().getNodeValue()));
NodeList resItem = root.getElementsByTagName("resItem");
Log.v("LiveVideoXmlParserByDom", ""+resItem.getLength());
for(int i=0;i<resItem.getLength();i++){
video = new LiveVideo();
Node itemNode = resItem.item(i);
//NodeList itemList = itemNode.getOwnerDocument().getDocumentElement();
Element root1= itemNode.getOwnerDocument().getDocumentElement();
NodeList resNameNode = root1.getElementsByTagName("resName");
if(resNameNode.item(0).getFirstChild()!=null)
video.setResName(resNameNode.item(0).getFirstChild().getNodeValue());
if(BaseData.DEBUG) Log.v("VideoAdapter",""+video.getResName());
video=null;
}
ÎÊÌ⣺res
Ïà¹ØÎÊ´ð£º
txt ºÍXML ¸ñʽÏàÓ¦
²»½èÖúDataSet
µ¼Èë¶ÁÈ¡TXTÎļþ
È»ºóÖ±½ÓдÈëXML(ͬһÎļþ,²»Í¬Êý¾Ý,µÝÔöÔÊý¾ÝûÓб»¸²¸ÇÇé¿öÏÂÔö¼ÓÊý¾Ý.)
½Ì¸öÒªµã»ò×îºÃÊÇÓиö´úÂëÌáʾµÄ
¹ý·ºÃºº °ï¸öæÈö^^
²»»á£¬°ïÂ¥Ö÷ ......
ÈçºÎ¶ÔxmlÄÚÈÝÊý¾Ý½øÐбȽÏ
ÀýÈ磺
<?xml version='1.0' encoding='utf-8'?>
<TestLIST>
<PID>40</PID>
<TestName>ÉîÛÚÊÐ</TestName>
......
Private Sub Command1_Click()
Dim MyString() As String
Open "a.xml" For Binary As #1 ' ´ò¿ª¸Õ´´½¨µÄÎļþ¡£
ReDim MyString(LOF(1) - 1)
Put #1, , MyRecord ' ¶ÁÈëËùÓÐ×Ö·ûµ½±äÁ¿ÖÐ ......
ΪʲôÎҵijÌÐòµ÷ÓÃXMLÅäÖÃÎļþÖеİ¢À²®ÎÄÏÔʾ²»³öÀ´£¿ÆäËûµÄÓïÖÖ¶¼¿ÉÒÔ£¬ÈçÖÐÎÄ£¬Ó¢ÎÄ£¬µÂÎĶ¼¿É¡£
ÎÒ½«XMLµÄ±àÂë¸ÄΪutf-8ºÍunicodeµÄµ½µÃ½á¹û¶¼Ò»Ñù.
°¢À²®ÎĵÄ×Ö¿âÄãÓÐô£¿
ÓÐ,ÎÒµÄEXEÊÇ·ÅÔÚpc»úÉÏÖ´Ðе ......