Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/393.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何按顺序显示父节点属性值和关联的子节点属性值?_Java_Xml - Fatal编程技术网

Java 如何按顺序显示父节点属性值和关联的子节点属性值?

Java 如何按顺序显示父节点属性值和关联的子节点属性值?,java,xml,Java,Xml,我对java编程完全是个新手,但到目前为止我很喜欢它,不过我遇到了一堵砖墙 客观的 获取父节点并显示名称 然后获取指定的关联子节点,并为相同类型的每个父节点显示名称rinse和repeat 有关详细信息,请参见随附的示例代码,我希望获取一次页面名称,即报表页面,然后获取一次查询名称,即提示年份,然后获取查询节点的所有数据项名称,即年份,然后对列表中的每个附加但不同的页面、查询和数据项重复此操作。我希望我已经足够清楚了,但是如果你需要进一步的信息,请告诉我 <page name="Repo

我对java编程完全是个新手,但到目前为止我很喜欢它,不过我遇到了一堵砖墙

客观的 获取父节点并显示名称 然后获取指定的关联子节点,并为相同类型的每个父节点显示名称rinse和repeat

有关详细信息,请参见随附的示例代码,我希望获取一次页面名称,即报表页面,然后获取一次查询名称,即提示年份,然后获取查询节点的所有数据项名称,即年份,然后对列表中的每个附加但不同的页面、查询和数据项重复此操作。我希望我已经足够清楚了,但是如果你需要进一步的信息,请告诉我

 <page name="Report Page">
</query><query name="Prompt Year">
      <source>
        <model/>
      </source>
      <selection>
        <dataItem aggregate="none" name="Year" rollupAggregate="none">
          <expression>'Year In Question'</expression>
        </dataItem>
      </selection>
      <queryHints>
        <useForParameterInfo value="true"/>
        <localCache value="true"/>
      </queryHints>
    </query><query name="Prompt Month">
      <source>
        <model/>
      </source>
      <selection>
        <dataItem aggregate="none" name="Month" rollupAggregate="none">
          <expression>'My Legal Entity'
</expression>
        </dataItem>
        <dataItem name="Reporting Month" aggregate="none" rollupAggregate="none">
          <expression>'Month In Question'</expression>
        </dataItem>
        <dataItem name="Month Name" aggregate="none" rollupAggregate="none">
          <expression>'Month Label'</expression>
        </dataItem>
      </selection>
      <queryHints>
        <useForParameterInfo value="true"/>
        <localCache value="true"/>
      </queryHints>
    </query><query name="Prompt Entity">
            <source>
                <model/>
            </source>
            <selection><dataItem name="Entities" aggregate="none" rollupAggregate="none"><expression>'Legal Entity Abroad'
            </expression></dataItem></selection>
        <queryHints><useForParameterInfo value="true"/><localCache value="true"/></queryHints></query>
        </page>