Print XML parsing to JspWriter (out) Class org.xml.sax.helpers.NewInstance can not access a member o

P

Per Magnus L?vold

Hi!
I am experimenting with javax.xml.parsers.SAXParser and have some
problems with printing the parsing events to JspWriter (out).
I have a JSP file wich receives a Buffered Reader. The JSP file passes
the BufferedReader and JspWriter so that the class extending
DefaultHandler can write to JspWriter (out) directly. But I beleive
passing JspWriter (out), I get the error message:
"Class org.xml.sax.helpers.NewInstance can not access a member of
class javax.xml.parsers.SAXParser with modifiers "protected""

Have I misunderstood the error message, or how can I come pass this
error message?

Example from code:

public class myXMLParser extends DefaultHandler
{
public JspWriter myOut = null;
public myXMLParser(JspWriter out, BufferedReader br)
{
try {
myOut = out;
myOut.println("<h2>Skal parse innholdet i XML filen</h2>");
// Lager XML (SAX) Parseren
XMLReader xr =
XMLReaderFactory.createXMLReader("javax.xml.parsers.SAXParser");
// Setter content handler
xr.setContentHandler(this);
// parse XML filen
xr.parse(new InputSource(br));
} catch (Exception e)
{
e.printStackTrace();
}
}
/*
* metode for start av XML Parsing
*/
public void startDocument() throws SAXException
{
try {
/* is this not allowed?? */
myOut.println("SAX Event - Start på fil");
} catch (IOException ioe)
{
System.out.println("Feil på startDocument()");
}
}

Regards, Per Magnus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top