例如考虑以下 xml
<root>
<childNode attribute1="value1">
<grandChildNode attrib1="val1" attrib2="val2">some content1
</grandChildNode>
<grandChildNode attrib1="val1" attrib2="val2">some content2
</grandChildNode>
<grandChildNode attrib1="val1" attrib2="val2">some content3
</grandChildNode>
</childNode>
<childNode attribute1="value1">
<grandChildNode attrib1="val1" attrib2="val2">some content1
</grandChildNode>
<grandChildNode attrib1="val1" attrib2="val2">some content2
</grandChildNode>
<grandChildNode attrib1="val1" attrib2="val2">some content3
</grandChildNode>
</childNode>
<childNode attribute1="value1">
<grandChildNode attrib1="val1" attrib2="val2">some content1
</grandChildNode>
<grandChildNode attrib1="val1" attrib2="val2">some content2
</grandChildNode>
<grandChildNode attrib1="val1" attrib2="val2">some content3
</grandChildNode>
</childNode>
</root>
使用 DOM 获取根节点,然后循环遍历 childNode 和 grandChildNode 是否有效,或者使用 XPath 表达式收集子节点和 grandChild 节点的详细信息是否有效?