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
Ïà¹ØÎÊ´ð£º
Êý¾Ý¿â±íÖÐÓÐÒ»ÁУ¨TranXml£©ÀàÐÍÊÇxml£¬´æ´¢µÄÊÇÀàËÆ
<fathernode>
<a>aaa
</a>
<b>bbb
</b>
</fathernode>
µÄÐÅÏ¢£¬²¢ÇÒͨ¹ý²éѯ·½· ......
´ÓÊý¾Ý¿âÖвéѯһÕűíµÄÊý¾Ý
select ²¿ÃÅ,ÐÕÃû from tb
ÈçºÎ²ÅÄÜÉú³ÉÏÂÃæµÄxml¸ñʽ
XML code:
<folder state="unchecked" label="È«²¿">
¡¡¡¡ <folder state="unchecked&qu ......
<?xml version="1.0"?>
<root>
<status>433</status>
<msg>Õâ¸öÊǺº×Ö</msg>
<serialno>123</serialno>
</root>
ÈçºÎÓÃASP¶ÁÈ¡ statusÖµ ......
ÎÒÔÚ±àдһ¸öwince5.0µÄ³ÌÐò£¬ÏëʵÏÖ°ÑPDAÉϵÄÒ»¸öLIST <STRING>ÀàÐ͵ÄÊý¾ÝÐòÁл¯ÎªXML£¬È»ºóÔÚPCÉϵÄÒ»¸öwebserviceÄõ½Õâ¸öXML£¬×ª»¯ÎªDataset£¬¸üÐÂPCÉϵÄÊý¾Ý¿â£¬ÎÒÏëÎÊÔõô°ÑXML´«¸øwebserviceµÄÄØ£¿
......
ÎÒÓÐÒ»¸öÀàËƵÄxmlµÄ string£¬Ïëͨ¹ý±éÀúÔõô¸öxml Êä³öÎÒÏëÒªµÄelementµÄÖµ
xml Ϊ£º
<Discover xmlns="urn:schemas-microsoft-com:xml-analysis">
<RequestType>DISCOVER_XML_ME ......