• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting started with xml

 
Anonymous
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
 
prabhu palanisamy
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic