Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ノード要素を2つの条件で選択したい。例えば:
<bbb> <aaa name="param1">val1</aaa> <aaa name="param2">val2</aaa> <aaa name="param3">val3</aaa> </bbb>
属性名が「param1」の要素aaaを取得したい。それを行う最善の方法は何ですか?
すでに Dom4j でドキュメントを解析していると仮定すると、...
Document doc = ... Node node = doc.selectSingleNode("//aaa[@name='param1']");
...動作するはずです。node変数には目的の要素が含まれている必要があります。
node