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

半城伤御伤魂 提交于 2019-12-08 18:37:42

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/8874979/why-is-my-itexthandler-not-working-im-trying-to-parse-xml-into-itextsharp-doc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!