[英]writing to a text file
I need to write some html tags into a txt file that has javascript in it as well.我需要将一些 html 标签写入一个包含 javascript 的 txt 文件中。 Can I just replace the html tag after creating the fresh tag?
创建新标签后,我可以只替换 html 标签吗? (if yes, how do I replace existing or old tag with new tag.).
(如果是,我如何用新标签替换现有或旧标签。)。 Or just recreate the whole content within that text file.
或者只是重新创建该文本文件中的全部内容。
I am using VS 2010, c#, it's a console app that I will have scheduler run 5am everyday.我正在使用 VS 2010,c#,它是一个控制台应用程序,我每天早上 5 点运行调度程序。
So, I have 2 tags (parent div and child div).所以,我有 2 个标签(父 div 和子 div)。 Basically I need to replace the child div.
基本上我需要替换子div。 Here is the link of the txt file.
这是txt文件的链接。 I am talking about child div "slide".
我说的是子 div“幻灯片”。 This is what I need to recreate every day.
这是我每天需要重新创建的。
<div class="slides_container">
<div class="slide">
<a href="http://www.flickr.com/photos/jliba/4665625073/" title="145.365 - Happy Bokeh Thursday! | Flickr - Photo Sharing!" target="_blank"><img src="img/slide-1.jpg" width="570" height="270" alt="Slide 1"></a>
<div class="caption" style="bottom:0">
<p>Happy Bokeh Thursday!</p>
</div>
</div>
<div class="slide">
<a href="http://www.flickr.com/photos/stephangeyer/3020487807/" title="Taxi | Flickr - Photo Sharing!" target="_blank"><img src="img/slide-2.jpg" width="570" height="270" alt="Slide 2"></a>
<div class="caption">
<p>Taxi</p>
</div>
</div>
Thanks Mike谢谢迈克
I would recommend you using a HTML Parser to manipulate HTML.我建议您使用 HTML 解析器来操作 HTML。 Html Agility Pack is great for this job.
Html 敏捷包非常适合这项工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.