• 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

xml experts help me SAX Parser in xml

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi friends,

I am learning SAX in xml. I am getting ArrayIndexOutOfBound Exception. can anybody know how to rectify this.

//this is the program which iam doing




//emp.xml file




//below is the dtd file


 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't specify an index outside the bounds of the array.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The useful information for you now is the stack trace which tells you what line of code threw the exception. Have a look at that, then have a look at the line of code which it points to.
 
naveena kamsali
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:The useful information for you now is the stack trace which tells you what line of code threw the exception. Have a look at that, then have a look at the line of code which it points to.




Parser p=ParserFactory.makeParser("org.apache.xerces.parsers.SAXParser");
FindAllEmployees fae=new FindAllEmployees();
fae.eno=args[0]; //here i got the exception can you please tell me how to solve this
p.setDocumentHandler((DocumentHandler) fae);
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The variable args refers to command line arguments - you are trying to run without a command line argument giving the XML document location.


Note that this use of the characters method:


will fail unexpectedly because the characters method may not get the entire text at a single call.

Bill
 
Grow a forest with seedballs and this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic