Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Parsing input from a string using JAXP, Xerces 1.4.1 with Visual Age

 
Nitish Naharas
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> 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?
 
Nitish Naharas
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic