【发布时间】:2016-04-24 13:26:52
【问题描述】:
我正在编写云服务并将 ASP.NET Web 角色与 WebForm 一起使用。
在我的代码中,我在 XElement 中获取数据,现在我想从中提取数据并在 WebForm 上以表格或网格格式显示
我的XElement 包含几个<entry> 标签,如下所示:
<entry xml:base="https://STORAGE_ACCOUNT.table.core.windows.net/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:etag="W/"datetime'2013-09-08T07%3A19%3A07.2189243Z'"" xmlns="http://www.w3.org/2005/Atom">
<id>https://STORAGE_ACCOUNT.table.core.windows.net/authors(PartitionKey='Beckett',RowKey='Molloy')</id>
<title type="text"></title>
<updated>2013-09-08T07:19:07Z</updated>
<author>
<name />
</author>
<link rel="edit" title="authors" href="authors(PartitionKey='Beckett',RowKey='Molloy')" />
<category term="STORAGE_ACCOUNT.authors" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
<d:PartitionKey>Beckett</d:PartitionKey>
<d:RowKey>Molloy</d:RowKey>
<d:Timestamp m:type="Edm.DateTime">2013-09-08T07:19:07.2189243Z</d:Timestamp>
<d:Artist>Beckett</d:Artist>
<d:Title>Molloy</d:Title>
</m:properties>
</content>
</entry>
我想提取以下标签
<d:Artist>Beckett</d:Artist>
<d:Title>Molloy</d:Title>
并在 ASPX 网络表单上以表格格式显示数据,如下所示
Artist Title
Beckett Moelly
如何在我的代码中执行此操作?
我看到了一些绑定到数据集的示例,但它适用于某些驱动器上的 xml 文件,但因为我的代码中有它。我还看到有人建议使用 XSLT 将 XML 转换为 HTML,然后显示它,但我不知道如何在代码中执行此操作。请给我指点
【问题讨论】:
标签: c# asp.net xml xslt webforms