NodeList中的NodeList

时间:2017-11-13 05:56:04

标签: java xml nodelist

我想更新标签。

  

如果'房间' < 2 => '阳台' => ' Y'

但是在代码中我需要做这样的研究:     update(id,name) - 应该是方法 我试图制作的伪代码:

1 search block where _ID=id
2 find _Name=name in block
3 check if 'rooms' <2 , if yes update <balcony> on 'Y' if its 'N'

任何人都可以帮助我。我是XML的初学者。不知道如何在nodeList中搜索nodeaList。谢谢你的帮助。

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project_folder>
    <block _ID="39">
        <sector>1</sector>
        <buildings>
            <building _NAME="santana">
                <rooms>4</rooms>
                <balcony>N</balcony>
            </building>
        </buildings>
    </block>
    <block _ID="40">
        <sector>2</sector>
    </block>
    <block _ID="41">
        <sector>3</sector>
        <buildings>
            <building _NAME="orange">
                <rooms>1</rooms>
                <balcony>N</balcony>
            </building>
            <building _NAME="lemon">
                <rooms>3</rooms>
                <balcony>N</balcony>
            </building>
            <building _NAME="grape">
                <rooms>2</rooms>
                <balcony>N</balcony>
            </building>
        </buildings>
    </block>
</project_folder>

0 个答案:

没有答案