aspose file tools*
The moose likes XML and Related Technologies and the fly likes Xml Parsing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Xml Parsing" Watch "Xml Parsing" New topic
Author

Xml Parsing

vineet kumar chaudhry
Ranch Hand

Joined: Apr 02, 2011
Posts: 45
Hi Java Lovers

I have just started SAX Parsing in Java.



Now I wanna parse the particular group(like admin,contact etc) and get the passcount of that particulatr group only .For example if I a want admin details

I shoud get the following output


Please help me with it.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
What do you have so far? Can you detect when a <Date> Element occurs?

Bill
vineet kumar chaudhry
Ranch Hand

Joined: Apr 02, 2011
Posts: 45
I was using below code



It gives me the following output

admin
Date :--->

Passcount :--->

admin
Date :--->

Passcount :--->
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
Try not setting bfname or the other flags to false until the matching endElement() is called.

Note that the characters () method may be called multiple times inside a given Text node.

Bill
g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 507
    
    3
This is how it should be modified (overlapping what have been advised).

[1] If you want to use String s uniformly and generally in the handler, move the declaration outside of the startElement handling.

[2] In the same spirit of electing the flags in the startElement() because the detection in all cases of interested is on the element's name, you should take down the flags in the endElement().

[3] Flags shouldn't be switched in the characters handling.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Xml Parsing