简体   繁体   中英

how to parse xml file having fluctuating tags and it's values, and how to parse it to android device.

I want to parse this xml file which having fluctuating tags and it's values, and i also want to parse it to android device. So i want to know what is the process to parse this xml code....?
And again i want to retrieve this to android device how it should be possible.

<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<Snippest>
    <Quadrant_I>
        <YQ_1>
            <YQ1>G</YQ1>
            <YQ2>C</YQ2>
            <YQ5>I</YQ5>
        </YQ_1>
        <YQ_2>
            <YQ1>F</YQ1>
            <YQ2>I</YQ2>
        </YQ_2>
        <YQ_5>
            <YQ1>B</YQ1>
            <YQ2>G</YQ2>
            <YQ5>C</YQ5>
            <YQ6>I</YQ6>
        </YQ_5>
        <YQ_6>
            <YQ1>G</YQ1>
            <YQ2>C</YQ2>
            <YQ5>I</YQ5>
            <YQ6>F</YQ6>
            <YQ3>E</YQ3>
            <YQ4>J</YQ4>
        </YQ_6>
    </Quadrant_I>
    <Quadrant_II>
        <YQ_3>
            <YQ1>F</YQ1>
            <YQ2>E</YQ2>
        </YQ_3>
        <YQ_4>
            <YQ1>F</YQ1>
            <YQ2>E</YQ2>
        </YQ_4>
        <YQ_7>
            <YQ1>F</YQ1>
            <YQ2>E</YQ2>
        </YQ_7>
        <YQ_8>
            <YQ1>NULL</YQ1>
        </YQ_8>
    </Quadrant_II>
    <Quadrant_III>
        <YQ_10>
            <YQ1>B</YQ1>
            <YQ2>H</YQ2>
            <YQ5>G</YQ5>
            <YQ6>D</YQ6>
            <YQ3>E</YQ3>
            <YQ4>F</YQ4>
            <YQ7>I</YQ7>
            <YQ8>J</YQ8>
            <YQ9>A</YQ9>
            <YQ10>C</YQ10>
        </YQ_10>
        <YQ_13>
            <YQ1>NULL</YQ1>
        </YQ_13>
        <YQ_14>
            <YQ1>B</YQ1>
            <YQ2>H</YQ2>
            <YQ5>E</YQ5>
        </YQ_14>
        <YQ_9>
            <YQ1>B</YQ1>
            <YQ2>G</YQ2>
        </YQ_9>
    </Quadrant_III>
    <Quadrant_IV>
        <YQ_11>
            <YQ1>NULL</YQ1>
        </YQ_11>
        <YQ_12>
            <YQ1>NULL</YQ1>
        </YQ_12>
        <YQ_15>
            <YQ1>H</YQ1>
            <YQ2>E</YQ2>
        </YQ_15>
        <YQ_16>
            <YQ1>NULL</YQ1>
        </YQ_16>
    </Quadrant_IV>
</Snippest>

Below parsers are available for you. you have to choose one depends on your application.

Dom, Stax, Sax

see here for more details and I have compared these parsers in my blog post

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM