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

📄 text.xtp

📁 resinweb服务器源文件
💻 XTP
字号:
<title section="Resin : XML Tutorial : ">Text</title><p/><var/Text/> nodes, like elements, are children of nodes.  The textvalue is retrieved using <var/getNodeValue()/>.<section title="Adding Text Nodes"><p/>Text nodes are added using the <var/appendChild()/> call, like Elements.<example title="Resulting XML">&lt;top>Hello, world&lt;/top></example><example title="Adding Attributes with the DOM">// Create a new documentDocument doc = builder.newDocument();// Create the top elementElement top = doc.createElement("top");// Create Text NodeText text = doc.createTextNode("Hello, world");// Add it to the toptop.appendChild(text);</example></section><section title="Getting Text Values"><p/>As mentioned above, the value of a text node is retrieved using<var/getNodeValue()/>.  The <var/name/> of a text node isalways <var/#text/>.  Normally, you'll either use <var/instanceof/> or<var/getNodeType()/> to tell if the node is a text node, but testingthe <var/name/> against <var/#text/> will work.<p/>The following function recursively prints all the text childrenof an element.  It tests against <var/CharacterData/> so <var/CDATA/>sections will also be printed.<example>void printText(Node node){  for (; node != null; node = node.getNextSibling()) {    if (node instanceof CharacterData)      System.out.print(ptr.getNodeValue());    printText(node.getFirstChild());  }}</example></section>

⌨️ 快捷键说明

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