Duh

 

I owe a dollar to the dunce jar

 

From: Alexis Pigeon [mailto:[email protected]] 
Sent: Tuesday, November 29, 2011 10:41 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] FYI about xmlworker and BR tags

 

Hi Jason,

On 29 November 2011 16:24, Jason Berk <[email protected]> wrote:

I have an html file with contents:

<html>
<body>
<p>
       <b>this is bold</b></br>
       This is not in bold
</p>
</body>
</html>

When I run XmlWorker I get this exception:
Exception in thread "main"
com.itextpdf.tool.xml.exceptions.RuntimeWorkerException: Invalid nested
tag br found, expected closing tag p.

public TestHTMLWorker() throws Exception {
               Document document = new Document();
               PdfWriter writer = PdfWriter.getInstance(document, new
FileOutputStream(
                               "/home/jberk/desktop/HTMLtoPDF.pdf"));
               writer.setInitialLeading(12);
               document.open();
               XMLWorkerHelper.getInstance().parseXHtml(writer,
document,
                               new FileReader(PROJECT_DIR +
"/test.html"));
               document.close();
       }

If I change "</br>" to "<br></br>" it works.


Well, that's a correct behaviour, isn't it?
You have a closing br tag, without the corresponding opening one: the XML file 
is not valid, I would expect XmlWorker to throw an Exception then. 

Aren't you mistaking with a self-closing br tag (i.e. <br/>) ?

Cheers,
alexis


This is a transmission from Purdue Federal Credit Union (Purdue Federal) and is 
intended solely for its authorized recipient(s), and may contain information 
that is confidential and or legally privileged. If you are not an addressee, or 
the employee or agent responsible for delivering it to an addressee, you are 
hereby notified that any use, dissemination, distribution, publication or 
copying of the information contained in this email is strictly prohibited. If 
you have received this transmission in error, please notify us by telephoning 
(765)497-3328 or returning the email. You are then instructed to delete the 
information from your computer. Thank you for your cooperation.

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to