本文介绍了在asp.net网页中显示xml文件内容的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨专家,

我想在asp.net中使用C#为以下类型的XML文件开发一个UI。

I would like to develop an UI in asp.net using C# for below kind of sample XML file.

我知道我们可以进行XSLT转换,在谷歌搜索之后,在xslt中我们可以提到简单的HTML UI控件。我需要asp.net服务器控件并需要在页面后面的代码中处理它的事件。

I know we can go for XSLT transformations, after googling, in xslt we can mention plain HTML UI control. What I need to asp.net server controls and need to handle its events in code behind page.

我也知道,在读取XML并准备一个xaml并将xaml提供给一个渲染后,在WPF中控制,它将负责显示到UI

I also know, in WPF after reading XML and prepare a xaml and give xaml to a render control, which will take care of displaying to UI

但我正在寻找asp.net webForm页面

But I’m looking in asp.net webForm pages

有人可以建议最好的方法来关注一些样本?

Could anyone suggest best approach to follow with some samples?

示例XML文件

<?xml version =" 1.0"编码= QUOT; UTF-8英寸standalone ="是"?>

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

< Root>

<Root>

< Users>

<Users>

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < FirstName value ="TestFirst"/>

               <FirstName value="TestFirst" />

               < LastName value ="TestLast"/>

               <LastName value="TestLast"/>

< / Users>

</Users>

< Machine>

<Machine>

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < Name value =""主机= QUOT;" sycTime = QUOT 1 QUOT; MAXCOUNT = QUOT; 10"&NBSP; />

               <Name value="" host="" sycTime="1" maxCount="10"  />

               < URL> HTTP://255.255.255:8008< / URL>

               <url>http://255.255.255:8008</url>

< /机>

</Machine>

< UISampleOne>

<UISampleOne>

               < Checkboxes value =" true" />

               <Checkboxes value="true" />

               <列>

               <Columns>

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < column columntext =" FirstName"宽度= QUOT;"&NBSP;数据类型= QUOT;串QUOT;
isreadonly =" true" />

                              <column columntext="FirstName" width=""  datatype="string" isreadonly="true" />

                   &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < column columntext ="姓氏"宽度= QUOT;"数据类型= QUOT;日期"
isreadonly =" false" />&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;

                              <column columntext=" LastName " width="" datatype="date" isreadonly="false" />     

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < column columntext =" Date"宽度= QUOT;"数据类型= QUOT;日期"
isreadonly =" false" />

                              <column columntext="Date" width="" datatype="date" isreadonly="false" />

   &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;  < / Columns>

                </Columns >

               <过滤>

               <Filter>

        < FilterType value =" FirstName"标签= QUOT;串QUOT; />

        <FilterType value="FirstName" label="string" />

        < FilterType value =" LastName"标签= QUOT;串QUOT; />

        <FilterType value="LastName" label="string" />

    < /过滤>

    </Filter>

< / UISampleOne>

</UISampleOne>

< UISampleTwo>

<UISampleTwo>

    ;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < SectionOne>

               <SectionOne>

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < FName value ="SectionFName"/>

                              <FName value="SectionFName" />

               &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < LName value ="SectionLName"/>

                              <LName value="SectionLName"/>

               < / SectionOne>

               </SectionOne>

               < SectionTwo>

               <SectionTwo>

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < FName value ="SectionFName"/>

                              <FName value="SectionFName" />

               &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < LName value ="SectionLName"/>

                              <LName value="SectionLName"/>

               < / SectionTwo>

               </SectionTwo>

< / UISampleTwo>

</UISampleTwo>

< UISampleThree>

<UISampleThree>

&NBSP;&NBSP ;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < ListsOne>

               <ListsOne>

     &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < list list_name =" ListName1" list_path =" / ABC / Xyz">

               <list list_name="ListName1" list_path="/ABC/Xyz">

        &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < item item_text =" ItemText" ITEM_NAME = QUOT; ItemName1" />

               <item item_text="ItemText" item_name="ItemName1"/>

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; &NBSP;&NBSP;&NBSP;&NBSP;
< item item_text =" ItemText" item_name =" ItemName1" />

                                             <item item_text="ItemText" item_name="ItemName1"/>

     &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; &NBSP;< /列表>

                </list>

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < list list_name =" ListName2" list_path =" / ABC2 / Xyz2">

                              <list list_name="ListName2" list_path="/ABC2/Xyz2">

        &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < item item_text =" ItemText" ITEM_NAME = QUOT; ItemName1" />

               <item item_text="ItemText" item_name="ItemName1"/>

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; &NBSP;&NBSP;&NBSP;&NBSP;
< item item_text =" ItemText" item_name =" ItemName1" />

                                             <item item_text="ItemText" item_name="ItemName1"/>

     &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < / list>

               </list>

   &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;  < / ListsOne>

                </ListsOne >

               < ListsTwo>

               <ListsTwo>

     &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < list list_name =" ListName1" list_path =" / ABC / Xyz">

               <list list_name="ListName1" list_path="/ABC/Xyz">

        &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < item item_text =" ItemText" ITEM_NAME = QUOT; ItemName1" />

               <item item_text="ItemText" item_name="ItemName1"/>

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; &NBSP;&NBSP;&NBSP;&NBSP;
< item item_text =" ItemText" item_name =" ItemName1" />

                                             <item item_text="ItemText" item_name="ItemName1"/>

     &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < /列表>

               </list>

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < list list_name =" ListName2" list_path =" / ABC2 / Xyz2">

                              <list list_name="ListName2" list_path="/ABC2/Xyz2">

        &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < item item_text =" ItemText" ITEM_NAME = QUOT; ItemName1" />

               <item item_text="ItemText" item_name="ItemName1"/>

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; &NBSP;&NBSP;&NBSP;&NBSP;
< item item_text =" ItemText" item_name =" ItemName1" />

                                             <item item_text="ItemText" item_name="ItemName1"/>

     &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < / list>

               </list>

   &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; &NBSP;< / ListsTwo>&NBSP;&NBSP;&NBSP;

                </ListsTwo>   

< / UISampleThree>

</UISampleThree>

< / root>

非常感谢,

推荐答案

http:// forums。 asp.net /

http://forums.asp.net/

但我建议您创建一个弹出窗口并将XML转储到其中。

But I would suggest that you make a popup window and dump the XML into it.


这篇关于在asp.net网页中显示xml文件内容的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 22:13