tika-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Raimund Merkert (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TIKA-651) Unescaped attribute value generated
Date Sun, 01 May 2011 18:37:03 GMT

    [ https://issues.apache.org/jira/browse/TIKA-651?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13027485#comment-13027485
] 

Raimund Merkert commented on TIKA-651:
--------------------------------------

Great, works nicely. 

I added some code to work around an issue with the img tag and now validates correctly with
[http://validator.w3.org/check].

{noformat} 
		ContentHandler serializer = new XHTMLSerializer(new OutputStreamWriter(
				xmlResult)) {

			{
				super.setDoctype(
						"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd",
						"-//W3C//DTD XHTML 1.0 Transitional//EN");
			}

			@Override
			public void startElement(String namespaceURI, String localName,
					String name, Attributes atts) throws SAXException {
				super.startElement(namespaceURI, localName, name, atts);
				if ("img".equals(localName)
						&& "http://www.w3.org/1999/xhtml".equals(namespaceURI)) {
					if (atts.getValue("alt") == null) {
						addAttribute("alt", "");
					}
				}
			}
		};
{noformat} 

> Unescaped attribute value generated
> -----------------------------------
>
>                 Key: TIKA-651
>                 URL: https://issues.apache.org/jira/browse/TIKA-651
>             Project: Tika
>          Issue Type: Bug
>          Components: parser
>    Affects Versions: 0.9
>            Reporter: Raimund Merkert
>         Attachments: XHTMLSerializer.java
>
>
> I've converted a word document that contains hyperlinks with a complex query component.
The & character is not escaped and mozilla complains about that when I write out the XHTML
via a content handler that I wrote.
> It's not clear to me whether or not my contenthandler should assume attributes are properly
escaped or not.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message