我正在寻找可以基于 xslt 将 html 转换为 xml 的解决方案。例如:
html:[这是来自 ektron(一个 CMS)的 html]
<p>Name: <input type="text" name="txtName" id="txtName" ektdesignns_caption="txtName" ektdesignns_name="txtName" title="txtName" ektdesignns_indexed="false" ektdesignns_nodetype="element" style="" size="24" class="design_textfield" value="Enter Name" /> 
</p>
<p>Age:<input type="text" name="txtAge" id="txtAge" ektdesignns_caption="txtAge" ektdesignns_name="txtAge" title="txtAge" ektdesignns_indexed="false" ektdesignns_nodetype="element" style="" size="24" class="design_textfield" /> </p>
<p>Place:<input type="text" name="txtPlace" id="txtPlace" ektdesignns_caption="txtPlace" ektdesignns_name="txtPlace" title="txtPlace" ektdesignns_indexed="false" ektdesignns_nodetype="element" style="" size="24" class="design_textfield" /> </p>
<p> Sex:<select name="rbSex" ektdesignns_maxoccurs="1" size="1" id="rbSex" ektdesignns_caption="rbSex" ektdesignns_name="rbSex" title="rbSex " ektdesignns_indexed="true" ektdesignns_nodetype="element" style="">
<option selected="selected" value="0">(Select)</option>
<option value="Male">Male</option>
<option value="Female">Female</option>
</select><span style="font-size: 12px; line-height: 0;"> </span><br /><br /> </p>
我手头有相应的 XSLT。
从这两个我想要一个XML如下
<root>
<txtName>DemoName</txtName>
<txtAge>21</txtAge>
<txtPlace>UK</txtPlace>
<rbSex>Female</rbSex>
</root>
我找到了一个执行此功能的应用程序 XMLWrench,但我需要一个 C#.net 解决方案,更像是一个 API 或其他东西。
编辑二:我也需要表单中的值,添加到 xml.eg:如果这些在名称文本框中存在名称,则应将其添加到 xml 节点中