<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # 解析一個HTML字符串 <div><h2>存在問題</h2> <p>來自用戶輸入,一個文件或一個網站的HTML字符串,你可能需要對它進行解析并取其內容,或校驗其格式是否完整,或想修改它。怎么辦?jsonu能夠幫你輕松解決這些問題</p> <h2>解決方法</h2> <p>使用靜態<code><a title="Parse HTML into a Document." href="http://jsoup.org/apidocs/org/jsoup/Jsoup.html#parse%28java.lang.String%29">Jsoup.parse(String html)</a></code> 方法或 <code><a title="Parse HTML into a Document." href="http://jsoup.org/apidocs/org/jsoup/Jsoup.html#parse%28java.lang.String,%20java.lang.String%29">Jsoup.parse(String html, String baseUri)</a></code>示例代碼:</p> <pre><code>String html = "&lt;html&gt;&lt;head&gt;&lt;title&gt;First parse&lt;/title&gt;&lt;/head&gt;" + "&lt;body&gt;&lt;p&gt;Parsed HTML into a doc.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;"; Document doc = Jsoup.parse(html); </code></pre> <h2>描述</h2> <p><code><a title="Parse HTML into a Document." href="http://jsoup.org/apidocs/org/jsoup/parser/Parser.html#parse%28java.lang.String,%20java.lang.String%29">parse(String html, String baseUri)</a></code> 這方法能夠將輸入的HTML解析為一個新的文檔 (Document),參數 baseUri 是用來將相對 URL 轉成絕對URL,并指定從哪個網站獲取文檔。如這個方法不適用,你可以使用 <code><a title="Parse HTML into a Document." href="http://jsoup.org/apidocs/org/jsoup/Jsoup.html#parse%28java.lang.String%29">parse(String html)</a></code> 方法來解析成HTML字符串如上面的示例。.</p> <p>只要解析的不是空字符串,就能返回一個結構合理的文檔,其中包含(至少)&nbsp;一個head和一個body元素。</p> <p>一旦擁有了一個Document,你就可以使用Document中適當的方法或它父類 <code><a title="A HTML element consists of a tag name, attributes, and child nodes (including text nodes and other elements)." href="http://jsoup.org/apidocs/org/jsoup/nodes/Element.html">Element</a></code>和<code><a title="The base, abstract Node model." href="http://jsoup.org/apidocs/org/jsoup/nodes/Node.html">Node</a></code>中的方法來取得相關數據。</p><br></div>
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看