Guest_imported
New member
- Jan 1, 1970
- 0
I'm trying to parse the xml from a string instead of from a file. The code compiles but nothing happens:
import java.io.*;
import org.xml.sax.*;
public class BandReader extends HandlerBase
{
public static void main(String[] args) throws Exception
{
System.out.println("Here we go ..."
BandReader readerObj = new BandReader();
readerObj.read();
}
public void read () throws Exception
{
String s = "<?xml version='1.0'?><bands><name></name></bands>";
Parser parserObj = new com.jclark.xml.sax.Driver();
StringReader reader = new StringReader(s);
InputSource source = new InputSource(reader);
parserObj.parse(source);
}
public void startDocument() throws SAXException
{
System.out.println("Starting ..."
}
public void endDocument() throws SAXException
{
System.out.println("... Finished"
}
public void startElement(String name, AttributeList atts)
throws SAXException
{
System.out.println("Element is " + name);
}
}
import java.io.*;
import org.xml.sax.*;
public class BandReader extends HandlerBase
{
public static void main(String[] args) throws Exception
{
System.out.println("Here we go ..."
BandReader readerObj = new BandReader();
readerObj.read();
}
public void read () throws Exception
{
String s = "<?xml version='1.0'?><bands><name></name></bands>";
Parser parserObj = new com.jclark.xml.sax.Driver();
StringReader reader = new StringReader(s);
InputSource source = new InputSource(reader);
parserObj.parse(source);
}
public void startDocument() throws SAXException
{
System.out.println("Starting ..."
}
public void endDocument() throws SAXException
{
System.out.println("... Finished"
}
public void startElement(String name, AttributeList atts)
throws SAXException
{
System.out.println("Element is " + name);
}
}