Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

IBM XML parser for JAVA

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to using XML in VAJ 3.5.3 environment.
I am using VAJ 3.5.3. I have imported IBM XML Parser for Java to my work bench. The example class compiles properly, but when run, I get a NoClassDefFoundError com.ibm.xml.parser.Parser.
How do I eliminate this error and run the code. Please help.

/**
* Starts the application.
* @param args an array of command-line arguments
*/
public static void main(java.lang.String[] args) {
Parser parser;
Document doc;
Element root;
FileInputStream FIS;
Node child,child2;
try
{
// Open the XML file passed as a parameter in memory.
FIS = new FileInputStream("d:/contacts.xml");
// Instantiating a Java based XML parser
// Passing the XML file to the XML parser
parser = new Parser("d:/contacts.xml");
doc = parser.readStream(FIS);
// Loading the memvar root with the root element in the XML tree
root = doc.getDocumentElement();
child = root.getFirstChild();

child2 = child.getNextSibling();
// Printing out the name of the root element in the XML tree
// in a DOS window
System.out.println("The Root Element is: " + root.getNodeName());
System.out.println("The First Child is: " + child.getNodeName());
System.out.println("The First Child is: " + child2.getNodeName());
}
// Primitive exception handling
catch (Exception excp)
{
System.out.println("Exception raised:" + excp.toString());
}
}
The xml file in D drive is
<?xml version="1.0" ?>
<EmpDetails>
<EmpName id="eoo1" age="22">Tesr</EmpName>
<Address>D3-83 NDA</Address>
</EmpDetails>
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As this is really a question of how to configure a particular IDE, I'll move it to the IDE forum for you.
 
Grow a forest with seedballs and this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic