📄 e524. visiting all the nodes in a dom document.txt
字号:
// Obtain an DOM document; this method is implemented in
// e510 The Quintessential Program to Create a DOM Document from an XML File
Document doc = parseXmlFile("infilename.xml", true);
visit(doc, 0);
// This method visits all the nodes in a DOM tree
public static void visit(Node node, int level) {
// Process node
// If there are any children, visit each one
NodeList list = node.getChildNodes();
for (int i=0; i<list.getLength(); i++) {
// Get child node
Node childNode = list.item(i);
// Visit child node
visit(childNode, level+1);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -