Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is my ITexthandler not working? I'm trying to parse XML into ITextSharp doc

I’m using Visual Developer 2010, MVC 3, c#. I’m trying to parse XML into an iTextSharp document like this:

        ITextHandler textHandler = new ITextHandler(doc);
        textHandler.Parse(xmldoc);

The error message says ITextHandler is not in this context. How can I make this work? Or is there another constructor that will do the same thing?

Here’s my list of using statements:

using System;
using System.IO;
using System.Text;
using System.Web;
using System.Web.Mvc;
using System.Xml;
using iTextSharp.text;
using iTextSharp.text.xml;
using iTextSharp.text.pdf;

Everything else seems to compile properly except for the ITextHandler line. Please help.

like image 225
CloudyKooper Avatar asked Jan 16 '12 01:01

CloudyKooper


1 Answers

ITextHandler is part of iText and iTextSharp 4.x series but was removed from the 5.x series in favor of iTextSharp.text.xml.simpleparser.SimpleXMLParser. In recent months, however, another project has been gaining favor for XML and HTML parsing. Most, if not all XML and HTML work going forward is being done in the separate library xmlworker found here. With in that library you'll find the iTextSharp.tool.xml.parser.XMLParser class.

like image 81
Chris Haas Avatar answered Nov 12 '22 06:11

Chris Haas