xml节点信息
xml:
<?xml version="1.0" encoding="utf-8" ?>
<library>
<name>首都图书馆</name>
<address>朝阳区华威桥南</address>
<books>
<book type="math">
<id>0000</id>
</book>
<book type="computer">
<id>0001</id>
<name>Xml初学</name>
<publisher>人民出版社</publisher>
<publishdate>2010-05-0-18</publishdate>
<fee>100.54</fee>
</book>
<book type="computer">
<id>0002</id>
<name>XSD定义</name>
<author>子弟</author>
<publisher>子弟出版社</publisher>
<publishdate>2010-05-0-18</publishdate>
<fee>102.54</fee>
</book>
</books>
</library>
cs:
XmlDocument doc=new XmlDocument();
doc.Load(System.AppDomain.CurrentDomain.BaseDirectory+"/htmlxml/books.xml");
XmlNodeList nodelist = doc.GetElementsByTagName("book");
XmlElement element = doc.GetElementById("b3");
XmlNode node = doc.SelectSingleNode("library/books/book[2]");
XmlNodeList nodelistselect = doc.SelectNodes("library/books/book");
Response.Write("Name: " + node.Name + "<br/>");
&n
相关文档:
是否厌倦了用xml文件来做Magento的页面布局,是的话来试试下面这种方式,把布局代码写到controller 里面
public function mycoolAction()
{
/* ... Some code ...*/
$update = $this->getLayout()->getUpdate();
/* ... Some code ...*/
$this->addActionLayoutHandles();
/* ... Some code ...*/
......
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Xml;
using System.Text; ......
2010-05-16
三、解析XML文档
l Xerces解析器、SAX类和接口
l SAX阅读器
n 首先要得到一个符合SAX org.xml.sax.XMLReader接口规范的例子,这个接口定义了解析行为并允许设置某些特征和属性。该接口替换了SAX1.0中的org.xml.sax.Parser
import org.apache.xerces.parsers.SAXParser;
import org.xml. ......
2010-05-18
五、验证XML
l 属性了特征方法
方 法
返回类型
参 数
语 法
setProperty()
void
String propertyId,
Object value
parser.setProperty(“[Property URI]”,
”[Object parameter]”);
setFeature()
void
String feat ......
Step 1:Form1 上添加一个ToolStripContainer控件
Step2:实现代码
private void Form2_Load(object sender, EventArgs e)
{
CMenuEx menu = new CMenuEx();
string sPath = "D:\\Menu.xml";//xml的内容
if (menu.FileExit())
&nb ......