• 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

getting started with xml

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
just downloaded the xerces parser.now, how do i go about writing xml files. what are the initialisations and path settings ,i have to do ? please help me write my first xml
document.
thanks,
sridevi
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi sridevi,
here i give a small code for SAX using XERCEs parser
import org.xml.sax.XMLReader;
import org.xml.sax.*;
import java.io.*;
import org.apache.xerces.parsers.SAXParser;
public class SaxDemo
{
public void perform(String uri)
{
System.out.println("uri "+uri);
try{
XMLReader xmlr=new SAXParser();
xmlr.parse(uri);
System.out.println("no error");
}
catch(IOException e)
{
System.out.println("error "+e.getMessage());
}
catch(SAXException e)
{
System.out.println("error "+e.getMessage());
}

}
public static void main(String args[])
{
System.out.println("hello");
SaxDemo sa=new SaxDemo();
sa.perform(args[0]);
}
}
for classpath set the \tools\xerces.jar
i hope this is sufficient to start...
bye
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!