• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SAX parser servlet help

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems that Ant won't let me compile this file since it appears to be laden with errors. What this servlet does is that it prompts for a search term provided by the user in order to search within an RSS feed for headlines that contain the search term, and write them out in HTML. The error that I keep getting is "illegal start of expression" in the startElement method. Can someone please see if the syntax is correct as well as point out the mistakes that I have made? Thanks.



[ November 18, 2004: Message edited by: Diego Tori ]
[ November 18, 2004: Message edited by: Diego Tori ]
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Diego,

Welcome to the ranch.

You code seems to involve a lot of stuff. Generally, its a good ide to seperate stuff and not put too much into one file. Here you have servlet code that seems to output HTML, which is good. But your attempt to stuff it with XML Parsing makes the code rather ugly and difficult to follow / debug.

If you agree that its difficult to debug, I would suggest that you seperate the parsing from the servlet code. Generally this is done inside a Java Bean class of some kind.

Also if you could tell us how familiar you are with Servlets / XML parsing, it would help us to point you in the right direction with some links.
Consider that and then lets see where we go...
regds.

- m
 
Diego Tori
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, it seems that I put a method in a method, and that's why it was laden with errors. I made some necessary changes to the code, but it's still throwing me some errors, possibly a syntax error. I just started learning how to write servlets a month ago, thus my knowledge is limited. How would I successfully integrate these classes into one servlet, a.k.a., the standard skeletal syntax for a servlet of this nature.

Here's some updated code:


[ November 19, 2004: Message edited by: Diego Tori ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic