[jdom-interest] How to parse this xml?

Jason Hunter jhunter at collab.net
Mon Nov 13 08:55:56 PST 2000


> ***************************************************
> <?xml version="1.0"?>
> 
> <computer>
>     <type>Personal Computer</type>
>         <subtype>Dell</subtype>
>         <subtype>Acer</subtype>
>         <subtype>Samsung</subtype>
>     <type>MiniComputer</type>
>         <subtype>MC1</subtype>
>         <subtype>MC2</subtype>
>         <subtype>MC3</subtype>
> </computer>
> ***************************************************

> I got no problem to get "<type>" element but
> could not get "<subtype>" data.

Notice that your subtypes are actually not subtypes.  Your </type> is
before the first <subtype>.  Here's indentation for what you really
have.

<computer>
    <type>Personal Computer</type>
    <subtype>Dell</subtype>
    <subtype>Acer</subtype>
    <subtype>Samsung</subtype>
    <type>MiniComputer</type>
    <subtype>MC1</subtype>
    <subtype>MC2</subtype>
    <subtype>MC3</subtype>
</computer>

-jh-



More information about the jdom-interest mailing list