Meaningless Drivel is fun!
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

How to get child count.

Himani Vashistha

Joined: Nov 17, 2006
Posts: 8

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!!!

Have you checked out Aspose?
subject: How to get child count.
It's not a secret anymore!