Hello,
I'm trying out the iText-tutorial Chapter 7 Example 4. I got all the jar files and the source files, and the compilation was OK. When I tried to run it, here's error I got:
***************************************************
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 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 the problem is at:
"XmlParser.parse(documentB, "Chap0703.xml", "tagmap0703.xml"); "
anyone has any ideas? Thanks.
~AC
The new MSN 8: smart spam protection and 2 months FREE* ------------------------------------------------------- This sf.net email is sponsored by: With Great Power, Comes Great Responsibility Learn to use your power at OSDN's High Performance Computing Channel http://hpc.devchannel.org/ _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions
