This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Xml Parsing

 
vineet kumar chaudhry
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you have so far? Can you detect when a <Date> Element occurs?

Bill
 
vineet kumar chaudhry
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 671
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic