【发布时间】:2012-08-14 17:10:06
【问题描述】:
我正在解决一个问题。我将提取 som HTML 文本并将它们存储为 Anchor 对象。例如:
<html>
<head>
<title>{dynamihead/}</title>
</head>
<body>
{repeatinghtml}
<p>{repeatinganchor1/}</p>
<p>{repeatinganchor2/}</p>
<p>{repeatinganchor3/}</p>
<p>{repeatinganchor4/}</p>
{/repeatinghtml}
</body>
</html>
我想提取 {} 锚点。如果它是一个自我终止的 achour,我想创建 {dynamihead/} 只是这个锚对象。但是如果它包含 childAnchours 我想提取像
{repeatinghtml}
<p>{repeatinganchor1/}</p>
<p>{repeatinganchor2/}</p>
<p>{repeatinganchor3/}</p>
<p>{repeatinganchor4/}</p>
{/repeatinghtml}
我想提取所有子锚点并将其放入主锚点的集合中。我已经拒绝了 Anchor 类,但我在字符串处理方面不太熟练,所以我无法提取我想要的文本。这是一个 Winform 应用程序,它将加载模板 HMLT 文件,对其进行处理并将信息插入到 ancours 中并发送电子邮件 i html 格式。
【问题讨论】:
-
我认为你可以使用Regex来提取字符串或XDocument