您现在的位置: 军旅同心 >> 读书赏析 >> 学习园地 >> 电脑网络 >> 技术文章 >> 文章正文
ASP.NET中的XML表单控件
作者:采集员 文章来源:来源于网络 点击数: 更新时间:2005-9-10 12:38:40
sp; while (node != null)
            {
                ShowDocument(node);
                node = node.NextSibling;
            }
        }
    }

    // Format the output
    private void Format (XmlNode node)
    {
        if (!node.HasChildNodes)
        {
           outputXml.Append(" " + "<" + node.Value + ">");
        }

        else
        {
            outputXml.Append("<" + node.Name + ">");
            if (XmlNodeType.Element == node.NodeType)
            {
                XmlNamedNodeMap map = node.Attributes;
                foreach (XmlNode attrnode in map)
                    outputXml.Append(" " + attrnode.Name + "<" + attrnode.Value + "> ");
            }
            outputXml.Append(" ");
        }
    }
}


下面就是webform2.aspx了
webform2.aspx
                                ---
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
<%@ Assembly Name="System.Xml" %>
<%@ Import Namespace="System.Xml" %>
<%@ Page Language="C#" Inherits="WebForm2" Src="WebForm2.cs" Debug="true" %>

<HTML><HEAD>

  <script runat="server" language="C#">
    // Put page script here
        public void On_KeyUp(object sender, System.EventArgs e)
    {
        Response.Write("Works");
    }

  </script>

<!--<link REL="STYLESHEET" HREF="default.css" TYPE="text/css">-->
<TITLE>test</TITLE>
</HEAD>

<BODY   >

    
<form method="post" action="WebForm2.aspx" runat="server" enctype="multipart/form-data">
  
<div align="left">
<table>
  <tr>
    <td>XML Document:</td>
    <td><input type=file id="XmlFile" runat=server>         FileName:</td>
    <td><asp:label id="FileLabel" runat="server"></asp:label></td>
  </tr>

  <tr>
    <td>XPath Expression</td>
    <td><asp:textbox id=TextBox1 runat="server" Height="20" Width="300" text=".//text()"
OnKey_Up="On_KeyUp"></asp:textbox></td>
    <td><asp:button type=submit OnClick="Query_Click" runat="server" Height="20" Width="91"
text="Query"></asp:button></td>
  </tr>
</table>

</br>
<table>
  <tr><td>Output from Query</td><td>XML Data</td><tr>
  <tr><td>Query Display: <asp:dropdownlist runat="server">
                         <asp:listitem>Descriptive</asp:listitem>
                         <asp:listitem>XML</asp:listitem>
                         </asp:dropdownlist>
  </td><tr>
  <tr>
    <td width="50%" valign="top" align="left"><asp:textbox id=TextBox2 runat="server" Height="400"
Width="350" TextMode="MultiLine" Rows="10"></asp:textbox></td>
    <td width="50%" valign="top" align="left"><asp:xml id="MyXml" transformsource="test.xsl"
runat=server/></asp:xml></td>
  </tr>
</table>
</div>

    <td><asp:textbox id=TextBox3 runat="server" Height="1" Width="5" TextMode="MultiLine"
Rows="110"></asp:textbox></td>

</form>
    
</BODY>
</HTML>

上一页  [1] [2] [3] 


 
免责声明:作品版权归所属媒体与作者所有!!本站刊载此文不代表同意其说法或描述,仅为提供更多信息。如果您认为我们侵犯了您的版权,请告知!本站立即删除。有异议请联系我们。
文章录入:烟灰缸    责任编辑:烟灰缸 
网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
| 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 | 网站公告 | 管理登录 |