<title text=“title1">
<comment id=“comment1">
<data> this is part of comment one</data>
<data> this is some more of comment one</data>
</comment>
<comment id=“comment2”>
<data> this is part of comment two</data>
<data> this is some more of comment two</data>
<data> this is even some more of comment two</data>
</comment>
</title>
그리고 다음 XPath 쿼리를 받았습니다.
/title/comment/@id
식이있는 하위 트리를 가져 오는 가장 좋은 방법은 무엇입니까? 속한다.
id="comment1"
id="comment2"
<comment id="comment1">
<data> this is part of comment one</data>
<data> this is some more of comment one</data>
</comment>
그리고 comment2
은 다음과 같이 속합니다.
<comment id=“comment2">
<data> this is part of comment two</data>
<data> this is some more of comment two</data>
<data> this is even some more of comment two</data>
</comment>
내가 원하는 이유는 Xpath식이 해결 된 하위 트리에서 재귀 적으로 호출을 할 수 있기 때문입니다.
DOM을 사용하여 자바에서 이것을 코딩하고 있습니다.
질문을 제대로 이해하지 못합니다. 의견 요소를 받아야합니까? id 속성을 갖는 comment 요소? –
내가 원하는 것은 xpath 표현식 (예 :'/ title/comment/@ id')이 주어지면이 요소 나 속성이있는 하위 트리를 공식화하거나 획득하는 방법이 필요합니까? 나는.'id = comment1'은 첫 번째 ' ... '하위 트리의 일부입니다. –
Larry