GeeCON Prague 2014*
The moose likes Java Micro Edition and the fly likes How to get child count. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "How to get child count." Watch "How to get child count." New topic
Author

How to get child count.

Himani Vashistha
Greenhorn

Joined: Nov 17, 2006
Posts: 8
Hi,

I have a file with text like:

<L [1]
<L [1]
<U4 [1] 85000>
>
>

< and > are like opening and closing braces, and [*] tells no. of childs in the list. Only a list can have childs. other elements like U4 are stand alone and can not have childs(Thats why closing ">" for U4 is in sequence with opening "<").

I need to validate above string, If a L[1] is specified it should have only one child, like in above example.

One wrong syntaxt is:
<L [2]
<U4 [1] 85000>
>

This is wrong as L[2] specifies 2 childs, but there is only one child into it.

I want to write recursive code for above validations....

Please Help!!!

Regards,
Himani.
 
GeeCON Prague 2014
 
subject: How to get child count.