易截截图软件、单文件、免安装、纯绿色、仅160KB

XMLNameSpace XML命名空间

XML 命名空间提供了一种避免元素命名冲突的方法。
命名空间属性一般放置在元素的开始标记处,其使用语法如下所示:
xmlns:namespace-prefix="namespace",
例如:xmlns:f="http://www.w3schools.com/furniture"
W3C 命名规范声明命名空间本身就是一个统一资源标示符,Uniform Resource Identifier (URI)。
asp.net读取XML命名空间方式
XmlNamespaceManager namespaceManager = new XmlNamespaceManager(rssDoc.NameTable);
            namespaceManager.AddNamespace("sns", "http://blog.sina.com.cn/sns");
            XmlNode NodeTotalPage = rssDoc.SelectSingleNode("rss/channel/sns:index/sns:text", namespaceManager);
在进入正题之前,我们先引用一个例子:
<table><tr><td>Apples</td><td>Bananas</td></tr></table>
在上面这个XML中,有点类似于我们以前见到的HTML中的表格的功能,其实你也可以那样简单的认为这样;
<table><name>African Coffee Table</name><width>80</width><length>120</length></table>
在这个XML中,我们描述了一个桌子的信息,这样假如我们把这两个XML放到一个XML文件中,就会遇到命名冲突的问题,于是便有了Name space.
XML的命名空间----解决上述问题的途径:
一.使用前缀解决命名冲突的问题:
上面的两个文件变为以下内容:
1--
<h:table><h:tr><h:td>Apples</h:td><h:td>Bananas</h:td></h:tr></h:table>
2--
<f:table><f:name>African Coffee Table</f:name><f:width>80</f:width><f:length>120</f:length></f:table>
现在是不是可以很明显的把两种不同的信息分开了呢,通过<h:table>与<f:table>就可以方便的引用这两个文件了,
二.使用命名空间来解决这个问题:
1--
<h:table xmlns:h="http://www.w3.org/TR/html4/"><h:tr><h:td>Apples</h:td><h:td>Bananas</h:td></h:tr></h:table>
2---
<f:table xmlns:f="http://www.w3.org/TR/xsl"><f:name>African Coffee Table</f:name><f:w


相关文档:

.net中,读取XML在页面显示,布局用Repeater控件

 public static IList<News> GetAllNews()
        {
            XmlDocument xdoc = new XmlDocument();
            xdoc.Load("你读取的地址:例如 ......

js 解析 xml 属性

function init() {
 var viewChartID = 0;
 var viewChartSum = "" ;
 reportName = document.getElementById("reportName").value;
 xmlDoc=loadXMLDoc("./charreport/xml/viewChart.xml");
 x=xmlDoc.getElementsByTagName('viewChart')[0].childNodes;
 for (i=0;i<x.length;i++ ......

从xml读取游戏配置信息或保存

 /*
* 主要作用;
* 从xml读取游戏配置信息或保存
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Forms;
using System.IO;
using System.Xml;
using System.Reflection;
namespace Game
{
class Config
{
Ke ......

检查xml错误

把xml拖到IE里就找到错在哪里了
如下:
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
文档的顶层无效。处理资源 'file:///D:/Tomcat 5.5/webapps/myapp/WEB-INF/web.xml' 时出错。第 1 行,位置: 44 ......

作的一个简单的XML功能(1)

//判断该xml文档是否存在,不存在则创建
  if (!File.Exists(Constants.SYS_CONFIGURE_URL + @"\SaveAccount.xml"))
                              &nbs ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号