File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes Parsing input from a string using JAXP, Xerces 1.4.1 with Visual Age 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 "Parsing input from a string using JAXP, Xerces 1.4.1 with Visual Age" Watch "Parsing input from a string using JAXP, Xerces 1.4.1 with Visual Age" New topic
Author

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

Nitish Naharas
Greenhorn

Joined: Jul 24, 2001
Posts: 6
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
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: 18671
> 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
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Parsing input from a string using JAXP, Xerces 1.4.1 with Visual Age
 
Similar Threads
SAXException within Servlet
SAXParser causes a null pointer exception when using internal DTD declaration?
I see alot of JAXP references on JR
XML Parser
Problems parsing a string with SAX