如题:
这是一个意外的标记。标记应为“NAME”。 行 2,位置 73。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.Xml.XmlException: 这是一个意外的标记。标记应为“NAME”。 行 2,位置 73。
以下是adorset.xml
<?xml version="1.0" standalone="yes" ?>
<NewDataSet>
<tbButton>
<Button>
<id>CN</id>
<text><asp:Button id="btnCN" runat="server" Text="中文按钮按" Width="112px"></asp:Button></text>
</Button>
<Button>
<id>EN</id>
<text><asp:Button id="btnEN" runat="server" Text="EnglishButton" Width="120px"></asp:Button></text>
</Button>
</tbButton>
</NewDataSet>以下是xsl1.xsl:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform "version="1.0"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:myutils="http://mycoolplace.com">
<xsl:template match="NewDataSet">
<TABLE>
<xsl:apply-templates select="NewDataSet/tbButton/Button"/>
</TABLE>
</xsl:template><xsl:template match="Button">
<TR>
<TD> <xsl:value-of select="text" disable-output-escaping="yes"/></TD>
</TR>
</xsl:template>
</xsl:stylesheet>以下是C#调用:
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(!Page.IsPostBack)
{
ShowHtml();
Response.Redirect("show.xml");
}
} private void ShowHtml()
{
string xmlpath = Server.MapPath("adorset.xml");
string xslpath = Server.MapPath("xsl1.xsl");
string output = Server.MapPath("show.xml"); Transform(xmlpath,xslpath,output);
} private void Transform(string source,string stylesheet,string output)
{
try
{
XslTransform xslt = new XslTransform();
xslt.Load(stylesheet);
xslt.Transform(source,output);
}
catch(Exception exp)
{
throw exp;
}
}
麻烦大家看看吧,谢谢了
这是一个意外的标记。标记应为“NAME”。 行 2,位置 73。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.Xml.XmlException: 这是一个意外的标记。标记应为“NAME”。 行 2,位置 73。
以下是adorset.xml
<?xml version="1.0" standalone="yes" ?>
<NewDataSet>
<tbButton>
<Button>
<id>CN</id>
<text><asp:Button id="btnCN" runat="server" Text="中文按钮按" Width="112px"></asp:Button></text>
</Button>
<Button>
<id>EN</id>
<text><asp:Button id="btnEN" runat="server" Text="EnglishButton" Width="120px"></asp:Button></text>
</Button>
</tbButton>
</NewDataSet>以下是xsl1.xsl:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform "version="1.0"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:myutils="http://mycoolplace.com">
<xsl:template match="NewDataSet">
<TABLE>
<xsl:apply-templates select="NewDataSet/tbButton/Button"/>
</TABLE>
</xsl:template><xsl:template match="Button">
<TR>
<TD> <xsl:value-of select="text" disable-output-escaping="yes"/></TD>
</TR>
</xsl:template>
</xsl:stylesheet>以下是C#调用:
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(!Page.IsPostBack)
{
ShowHtml();
Response.Redirect("show.xml");
}
} private void ShowHtml()
{
string xmlpath = Server.MapPath("adorset.xml");
string xslpath = Server.MapPath("xsl1.xsl");
string output = Server.MapPath("show.xml"); Transform(xmlpath,xslpath,output);
} private void Transform(string source,string stylesheet,string output)
{
try
{
XslTransform xslt = new XslTransform();
xslt.Load(stylesheet);
xslt.Transform(source,output);
}
catch(Exception exp)
{
throw exp;
}
}
麻烦大家看看吧,谢谢了
解决方案 »
- 两数据库连接,最多只要右表的一行,如何做?
- ListBox二级效果未实现...
- ASP.NET文件流保存问题,高手请进!!
- 问一个弱问题,请问sqlserver 2000中的备注型字段是?
- 请问我在asp.net 如何调用存储过程的返回值??
- ???菜鸟刚学用c#做asp.net,请问怎么弹出一个对话框???
- 请问那位有vb写的asp.net新闻发布系统?提供一个,谢了
- 关于数据库的一个问题
- VS.NET中的"生成解决方案"和"重新生成解决方案"有什么区别?
- 隐藏uploadify控件按钮 js触发选择文件事件
- 我的菜单被 Flash 给挡住了.怎么办呀?急呀......
- DataSet的ReadXml方法的效率怎么样?相对逐行解析xml将数据装进DataTable的效率有多大提高?
应该是<?xml version="1.0" encoding="GB2312" standalone="yes"?>吧。
试过了,还是老样子.急啊
—〉
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform " version="1.0"你把你的xml和xsl放在同一文件夹下,用ie打开看看哪里报错就知道了。
<TABLE>
<xsl:apply-templates select="tbButton/Button"/>
</TABLE>
</xsl:template>2. also, you shouldn't use < and > you should use straight < />, since controls need to have an end or closing tag3. you are dynamically creating .xml files with <runat=server> controls in it? why?
<?xml version="1.0" encoding="GB2312"?>
<?xml-stylesheet type="text/xsl" href="1.xsl"?>
<NewDataSet>
<tbButton>
<Button>
<id>CN</id>
<text><asp:Button id="btnCN" runat="server" Text="中文按钮" Width="112px"></asp:Button></text>
</Button>
<Button>
<id>EN</id>
<text><asp:Button id="btnEN" runat="server" Text="EnglishButton" Width="120px"></asp:Button></text>
</Button>
</tbButton>
</NewDataSet>
1.xsl
<?xml version="1.0" encoding="GB2312"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" version="4.0" encoding="GB2312"/>
<xsl:template match="/">
<TABLE border="1">
<xsl:apply-templates select="./NewDataSet/tbButton/Button"/>
</TABLE>
</xsl:template><xsl:template match="Button">
<TR>
<TD> <xsl:value-of select="./text"/></TD>
</TR>
</xsl:template>
</xsl:stylesheet>
建议楼主多看看X-Path和xslt的一些基本指令。另外,如果想解析出html标签来
http://www.cnblogs.com/dsclub/archive/2004/08/19/34661.html