从xml检索 [英] Retrieve from xml
本文介绍了从xml检索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
如何从xml获取数量值?
Hi
How do i get the quantity value from xml?
<groceries>
<item name="x" quantity="123"> xperia</item>
</groceries>
我想在javascript中检索它.
i want to retrieve it in javascript.
推荐答案
也许您需要了解如何读取xml文件.检查以下链接:
http://www.c-sharpcorner.com/uploadfile/mahesh/readwritexmltutmellli2111282005041517am/readwritexmlxutmellli21. /a> [ ^ ]
< edit>您还应该使用XPath轻松浏览文档.
http://www.w3schools.com/xpath/ [ http://www.devshed.com/c/a/XML/XPath-Basics/4 / [^ ]
http://www.roseindia.net/tutorials/xPath/using-nameXPath.shtml [ ^ ]
http://www.codeproject.com/Messages/3672163/Re-Read- XML-in-Csharp.aspx [ ^ ]
http://www.codeproject.com/Messages/3676567/Re-Csharp-XML-Query-Website-address-based-on-Websi.aspx [
Perhaps you need to know how to read an xml file. Check link below:
http://www.c-sharpcorner.com/uploadfile/mahesh/readwritexmltutmellli2111282005041517am/readwritexmltutmellli21.aspx[^]
<edit> You should also use XPath for easy navigation of your document.
http://www.w3schools.com/xpath/[^]
http://www.devshed.com/c/a/XML/XPath-Basics/4/[^]
http://www.roseindia.net/tutorials/xPath/using-nameXPath.shtml[^]
http://www.codeproject.com/Messages/3672163/Re-Read-XML-in-Csharp.aspx[^]
http://www.codeproject.com/Messages/3676567/Re-Csharp-XML-Query-Website-address-based-on-Websi.aspx[^]
使用此XPath 杂货/物品,它将返回您所有的物品节点.
进一步遍历每个项目节点和每个节点的精量Attibute
.
Use this XPath groceries/item, Which will return you all the item node.
Further loop through Each item node and fine quantityAttibute
from each.
Foreach(Xmlnode node in nodelist)
{
node.Attributes["quantity"].Value;
}
可能会对您有所帮助.
It might help you.
这篇关于从xml检索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文