[英]How do I Parse an HTML file in CGI application and modify its contents? C++
I'm really new to this. 我真的是新来的。 I am trying to write a CGI program that will take a pseudo-html file, find certain tags, and replace them with something else. 我正在尝试编写一个CGI程序,该程序将使用伪html文件,查找某些标记,并将其替换为其他标记。
For example, if there is an html file, that has a " <list>
" tag (which I believe is not an html tag), it would replace that tag with a list that it generates. 例如,如果有一个带有“ <list>
”标记(我相信不是html标记)的html文件,它将用生成的列表替换该标记。
Is there an easy way of going about this? 有一个简单的方法来解决这个问题吗? Or do I essentially need to do it from scratch? 还是我本质上需要从头开始?
I'm thinking about using the CGI++ library, does it have such a functionality? 我正在考虑使用CGI ++库,它具有这样的功能吗?
Thanks 谢谢
What you're asking for is generally called a templating engine - read the almost-HTML with special tags in it, interpret the tags. 您所要求的通常称为模板引擎-阅读其中带有特殊标签的几乎HTML的内容,解释这些标签。 Frameworks like PHP were invented specifically for this kind of thing. 像PHP这样的框架是专门为这种事情发明的。 Ditch C++, use PHP. 沟C ++,使用PHP。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.