----Original Message Follows----
From: "alan chen" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: XML to PDF runtime error
Date: Mon, 16 Dec 2002 10:54:12 -0500


Help STOP SPAM with the new MSN 8 and get 2 months FREE*
--- Begin Message ---

Hello,

I am trying out the iText tutorial Chapter 7 Example 4. I have all the jar files in my path and everthing compile ok. but I got this error when I tried to run it:

----------------------------------

Chapter 7 example 4: making life easy

ExceptionConverter: ExceptionConverter: java.lang.NullPointerException

 void org.apache.crimson.parser.Parser2.parseInternal(org.xml.sax.InputSource)

  Parser2.java:524

 void org.apache.crimson.parser.Parser2.parse(org.xml.sax.InputSource)

  Parser2.java:305

 void org.apache.crimson.parser.XMLReaderImpl.parse(org.xml.sax.InputSource)

  XMLReaderImpl.java:442

 void org.xml.sax.helpers.XMLReaderAdapter.parse(org.xml.sax.InputSource)

  XMLReaderAdapter.java:223

 void javax.xml.parsers.SAXParser.parse(org.xml.sax.InputSource, org.xml.sax.HandlerBase)

  SAXParser.java:362

 void com.lowagie.text.xml.TagMap.init(java.io.InputStream)

 void com.lowagie.text.xml.TagMap.<init>(java.lang.String)

 void com.lowagie.text.xml.XmlParser.go(com.lowagie.text.DocListener, java.lang.String, java.lang.String)

 void com.lowagie.text.xml.XmlParser.parse(com.lowagie.text.DocListener, java.lang.String, java.lang.String)

 void ItextPdf.main(java.lang.String[])

  ItextPdf.java:25

java.lang.NullPointerException
-----------------------------------------------

here's my source code:
-------------------------


import java.io.FileOutputStream;

import com.lowagie.text.Document;
import com.lowagie.text.PageSize;
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.xml.XmlParser;

public class ItextPdf {
  public static void main(String[] args){
    System.out.println("Chapter 7 example 4: making life easy");       
    // step 1: creation of a document-object
    //Document documentA = new Document(PageSize.A4, 80, 50, 30, 65);   
    // step 1: creation of a document-object
    Document documentB = new Document(PageSize.A4, 80, 50, 30, 65);       
    try {       
      // step 2:
      // we create a writer that listens to the document
      // and directs a XML-stream to a file
      //PdfWriter.getInstance(documentA, new FileOutputStream("Chap0704a.pdf"));
      documentB.open();
      PdfWriter.getInstance(documentB, new FileOutputStream("Chap0704b.pdf"));        
      // step 3: we parse the document
      //XmlParser.parse(documentA, "Chap0701.xml");
      XmlParser.parse(documentB, "Chap0703.xml", "tagmap0703.xml");     
    }catch(Exception e) {
      e.printStackTrace();
      System.err.println(e.getMessage());
    }
  }

}

-----------------------------

It seems that the problem is at :

" XmlParser.parse(documentB, "Chap0703.xml", "tagmap0703.xml");"     

anybody got any ideas??

--- End Message ---

Reply via email to