基于C#中字符串中的html标记创建单独的XML文件 [英] create separate XML file based on html tags in a string in C#

查看:58
本文介绍了基于C#中字符串中的html标记创建单独的XML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一个很长的字符串,如 
< abcd>< xyz> testingmessage like this< / XYZ>< / ABCD>< ABCD> < xyz> testingmessage像这样< / xyz>< / abcd>< abcd> < xyz> testingmessage像这样< / xyz>< / abcd>< abcd> < xyz> testingmessage
喜欢这个< / xyz>< / abcd>


我想创建一个单独的xml文件,基于  < abcd>< xyz>  和  < / xyz>< / abcd> 这些
xml标签例如:  < abcd>< xyz> testingmessage
像这样< / xyz>< / abcd>
视为一个xml文件。我知道它是一个子串搜索C#中的字符串,但是有任何最快的方法可以做到这一点或任何其他方式来实现这一点。有关这方面的任何线索都会有所帮助。请帮助。我必须用
在C#中执行此操作,还是可以执行此操作这是使用javascript。

I want to create a separate xml file based on <abcd><xyz> and </xyz></abcd>these xml tags eg : <abcd><xyz>testingmessage like this</xyz></abcd>consider as one xml file . I know it's a substring search in a string in C# but is there any fastest way to do this or any other way to achieve this . Any clue regarding this will be helpful . Please help . I have to do this in C# or can I do this using javascript .


编辑 我想基于  < abcd>< xyz>
和< / xyz>< / abcd>
 字符串中的这些xml标签。

EDIT I want to create separate xml file based on <abcd><xyz> and </xyz></abcd> these xml tags in a string .

推荐答案

如果您在前面添加缺少的元素,例如"< xml>"+ your-long-string +"< / xml>",那么它看起来像一个XML文件,可以保存,解析等

显示单独XML文件的预期内容。


这篇关于基于C#中字符串中的html标记创建单独的XML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆