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

Discussion in 'Java' started by Per Magnus L?vold, Nov 15, 2004.

  1. 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
     
    Per Magnus L?vold, Nov 15, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Aryeh M. Friedman
    Replies:
    3
    Views:
    1,503
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=
    Oct 15, 2007
  2. Gerald Bauer
    Replies:
    0
    Views:
    114
    Gerald Bauer
    Feb 25, 2009
  3. Erik Wasser
    Replies:
    5
    Views:
    463
    Peter J. Holzer
    Mar 5, 2006
  4. PerlFAQ Server
    Replies:
    0
    Views:
    690
    PerlFAQ Server
    Feb 3, 2011
  5. PerlFAQ Server
    Replies:
    0
    Views:
    697
    PerlFAQ Server
    Apr 4, 2011
Loading...

Share This Page