<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          htmlcxxHTML和CSS的C++解析器

          聯(lián)合創(chuàng)作 · 2023-09-21 23:58

          htmlcxx 是一個(gè) C++ 的 HTML 解析器和 CSS1 的解析器。The parsing politics attempt to mimic the behavior of Mozilla Firefox, so you should expect parse trees similar to those created by Firefox. However, it does not insert nonexistent stuff in your HTML. Therefore, serializing the DOM tree gives exactly the same output as the original HTML document. Another key feature is an STL-like tree navigation API provided by the tree.hh template library.

          示例代碼:

            #include <htmlcxx/html/ParserDom.h>
          ...

          //Parse some html code
          string html = "<html><body>hey</body></html>";
          HTML::ParserDom parser;
          tree<HTML::Node> dom = parser.parseTree(html);

          //Print whole DOM tree
          cout << dom << endl;

          //Dump all links in the tree
          tree<HTML::Node>::iterator it = dom.begin();
          tree<HTML::Node>::iterator end = dom.end();
          for (; it != end; ++it)
          {
          if (it->tagName() == "A")
          {
          it->parseAttributes();
          cout << it->attributes("href");
          }
          }

          //Dump all text of the document
          it = dom.begin();
          end = dom.end();
          for (; it != end; ++it)
          {
          if ((!it->isTag()) && (!it->isComment()))
          {
          cout << it->text();
          }
          }
          瀏覽 29
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  亚洲一级在线免费视频 | 国产成人自拍视频在线 | 免费看黄A级毛片成人片 | 黄色精品在线观看 | 亚洲人妖在线 |