⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 elements.xtp

📁 resinweb服务器源文件
💻 XTP
字号:
<s1 title="Adding Elements"><p>Elements in XML are the same as tags.  This example will create adocument and add some elements to it.</p><example title="Resulting XML">&lt;top>  &lt;a/>  &lt;b/>  &lt;c/>&lt;/top></example><p>All the DOM nodes are created using the Document object.  Each nodecreated by a Document belongs to that document.  You can't directly addnodes from one document to another document.  (Although you can <var/import/>the node.)</p><p>Documents are intrinsically implementation-dependent.To bootstrap this process, you need to create the Document.Sun's JAXP DocumentBuilder gives an implementation-independent methodfor creating a document.</p><example title="Creating Elements with the DOM">import java.io.*;import javax.xml.parser.*;import org.w3c.dom.*;import com.caucho.xml.*;...// Create a new parser using the JAXP API (javax.xml.parser)DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();DocumentBuilder builder = factory.newDocumentBuilder();// Create a new documentDocument doc = builder.newDocument();// Create the top elementElement top = doc.createElement("top");// Add it to the documentdoc.appendChild(top);// Add elements to the toptop.appendChild(doc.createElement("a"));top.appendChild(doc.createElement("b"));top.appendChild(doc.createElement("c"));</example></s1>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -