Parsing input from a string using JAXP, Xerces 1.4.1 with Visual Age
Nitish Naharas
Greenhorn
Joined: Jul 24, 2001
Posts: 6
posted
0
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
Sunder kumar Sethu
Greenhorn
Joined: Jun 17, 2001
Posts: 10
posted
0
How did u include jar file in VisualAGe R u using 3.5 E. Edition? so..first u need to download xerces.jar and jaxp jar ..and include in classpath? i wanted to write some sample xml programs in vaj
Jim Yingst
Wanderer
Sheriff
Joined: Jan 30, 2000
Posts: 18652
posted
0
> 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
Nitish Naharas
Greenhorn
Joined: Jul 24, 2001
Posts: 6
posted
0
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
subject: Parsing input from a string using JAXP, Xerces 1.4.1 with Visual Age