This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi, I am trying to use a String for parsing input to a Xerces SaxParser using JAXP. My code is similar to the following:
//create a SAX parser SAXParser saxParser = MyUtilsXML.newParser("true"); //create an input source from input XML string String sParseString = "<?xml version=1.0?><DOCTYPE PurchaseOrder SYSTEM PO_v1.dtd>....."; StringReader stringReader = new StringReader(sParseString); InputSource inputSource = new InputSource(stringReader); //set up Handler InboundXMLHandler irqHandler = new InboundXMLHandler(); //parse the input XML saxParser.parse(inputSource, new InboundXMLHandler()); I am getting a Java Internal error when trying to debug this code using Visual Age for Java compiler. Can I use a String input to create an inout source for the compiler ? Am I doing something that is not allowed? Thanks, Nitish
> I am getting a Java Internal error when trying to debug this > code using Visual Age for Java compiler. Well, give us a clue. What does the error message say? Look at the stack trace - which line is the error coming from?
"I'm not back." - Bill Harding, Twister
Joined: Jul 24, 2001
Thanks Jim. What I did was I tried the same code using Visual Cafe and it ran perfectly without any problems. I was getting the same message as you i.e. Internal error. I think there could be two things: 1. something wrong with the classpath 2. Since VAJ uses IBM parser in the repository (taken from Xerces code), somehow it may be getting an incorrect version of Xerces.jar. Sunder - to answer your question: 1. I am using VAJ enterprise edition 3.5 2. You don't need to use jaxp.jar since xerces.jar already has underlying class definitions. 3. To set the classpath, right click on Class name, it will show a menu item for "Run", one of the options of Run is "Check classpath". - Nitish