📄 html.xtp
字号:
<s1 title="HTML Parsing"><p>Resin includes an HTML parser. Parsing HTML is convenient:</p><ul><li>Parse documents created by HTML editors.<li>Parse documents on the web.<li>Provide a HTML interface for web designers.</ul><p>Parsing HTML is like using the JAXP interface, except you'll be usingResin's API.</p><p>Because printing HTML uses different rules from XML, e.g. <img> hasno end tag, you'll need to use <var/printHtml/> instead ofjust <var/print/>.</p><example title="Parsing HTML">import java.io.*;import org.w3c.dom.*;import com.caucho.xml.*;...Html parser = new HtmlParser();// Parse the file into a DOM Document (org.w3c.dom)Document doc = parser.parse("test.html");// Create a new HTML printer (com.caucho.xml)FileOutputStream os = new FileOutputStream("out.xml");XmlPrinter printer = new XmlPrinter(os);// Print the document using HTML rulesprinter.printHtml(doc);os.close();</example><p>You can also take advantage of Resin's VFS API and parse documentsdirectly from the web:</p><example title="Parsing HTML">import java.io.*;import org.w3c.dom.*;import com.caucho.xml.*;...Html parser = new HtmlParser();Path yahoo = Vfs.lookup("http://www.yahoo.com");// Parse the file into a DOM Document (org.w3c.dom)Document doc = parser.parse(yahoo);</example></s1>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -