GeeCON Prague 2014*
The moose likes XML and Related Technologies and the fly likes xml experts help me SAX Parser in xml 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 experts help me SAX Parser in xml" Watch "xml experts help me SAX Parser in xml" New topic
Author

xml experts help me SAX Parser in xml

naveena kamsali
Greenhorn

Joined: Sep 20, 2011
Posts: 8
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


Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61310
    
  66

Don't specify an index outside the bounds of the array.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

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

Joined: Sep 20, 2011
Posts: 8
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);
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12791
    
    5
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
 
GeeCON Prague 2014
 
subject: xml experts help me SAX Parser in xml