You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Per Newgro <pe...@gmx.ch> on 2017/11/21 11:37:12 UTC

Can I use wicket to emend my markup?

Hello,

i try to render HTML markup with flying saucer to PDF.
In case i render the page by wicket and use that result markup in my flying saucer wicket resource, everything is ok.

Because i need to generate some SVG by browser using javascript (d3.js) i would like to send the markup from browser to my FS wicket resource.

My main problem is that sending the html by using document.documentElement.outerHTML destroys the markup. It cuts of the end-tag from my
link element. So the flying saucer complains on a missing link end-tag.

Example

My original html looks like this
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
		<title>Apache Wicket Quickstart</title>
		<link rel="stylesheet" href="style.css" type="text/css" media="screen" title="Stylesheet" />
	</head>
	<body>
		<div id="hd">
			<div id="logo">
				<img src="logo.png" width="50px" height="50px" alt="Wicket Logo" />
				<h1>Apache Wicket</h1>
			</div>
		</div>
....

after sending result of document.documentElement.outerHTML as form-data to wicket resource i receive

 <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head>
		<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8">
		<title>Apache Wicket Quickstart</title>
		<link rel="stylesheet" href="http://localhost:8080/style.css" type="text/css" media="screen" title="Stylesheet">
	</head>
	<body cz-shortcut-listen="true">
		<div id="hd">
			<div id="logo">
				<img src="logo.png" width="50px" height="50px" alt="Wicket Logo">
...

The meta and link end-tags have been removed (i suspect the browser doing that).

Flying saucer complains then with
1:36:41.764 [qtp2116908859-19] WARN  RequestCycleExtra - Handling the following exception
org.xhtmlrenderer.util.XRRuntimeException: Can't load the XML resource (using TrAX transformer). org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 4; Elementtyp "link" muss mit dem entsprechenden Endtag "</link>" beendet werden.
	at org.xhtmlrenderer.resource.XMLResource$XMLResourceBuilder.transform(XMLResource.java:222) ~[flying-saucer-core-9.1.6.jar:?]
	at org.xhtmlrenderer.resource.XMLResource$XMLResourceBuilder.createXMLResource(XMLResource.java:181) ~[flying-saucer-core-9.1.6.jar:?]
	at org.xhtmlrenderer.resource.XMLResource.load(XMLResource.java:84) ~[flying-saucer-core-9.1.6.jar:?]
	at org.xhtmlrenderer.pdf.ITextRenderer.setDocumentFromString(ITextRenderer.java:161) ~[flying-saucer-pdf-itext5-9.1.6.jar:?]


What i would like to know is - can i send the markup to a "wicket class" and emend the corrupt tags?
I would like to avoid to handle every corrupt tag manually.

Thanks for your support
Per

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org