• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

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

 
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

 
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
 
Wanderer
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
 
Are you okay? You look a little big. Maybe this tiny ad will help:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!