简体   繁体   English

如何在CGI应用程序中解析HTML文件并修改其内容? C ++

[英]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.

相关问题 如何在C ++中使用asio.boost修改Web上文件的内容? - how can i modify the contents of a file on the web using asio.boost in c++? 如何用{}块C ++解析文件 - How do I parse a file with {} block C++ 如何解析带有换行符的文件作为 C++ 中的分隔符? - How do I parse a file with line breaks as a delimiter in c++? 如何在 C++ 中打开一个文件,而不删除它的内容并且不附加它? - How can I open a file in c++, without erasing its contents and not append it? C++ 解析文件并将内容存储到 map - C++ parse a file and store contents into a map 如何将文件与C ++应用程序的二进制文件打包在一起? - How do I pack a file together with the binary of a C++ application? 如何打印出文件的内容? C++ 文件流 - How do I print out the contents of a file? C++ File Stream 如何在Visual C ++ 6程序中正确修改.def文件? - How do I properly modify a .def file in a Visual C++ 6 program? 如何通过 C++ 中的 header 文件将可选参数传递和修改给 function? - How do I pass and modify an optional argument to a function through a header file in C++? C++:如何将 std::string 的内容写入 UTF-8 编码文件? - C++: How do I write the contents of std::string to a UTF-8 encoded file?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM