You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Brian Minchau (JIRA)" <xa...@xml.apache.org> on 2006/10/30 20:33:18 UTC
[jira] Assigned: (XALANJ-2323) closeStartTag() in ToHTMLSAXHandler
does not pass localName or namespace to the ContentHandler. Results in
ValidationException in Apache FOP.
[ http://issues.apache.org/jira/browse/XALANJ-2323?page=all ]
Brian Minchau reassigned XALANJ-2323:
-------------------------------------
Assignee: Brian Minchau
> closeStartTag() in ToHTMLSAXHandler does not pass localName or namespace to the ContentHandler. Results in ValidationException in Apache FOP.
> ----------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: XALANJ-2323
> URL: http://issues.apache.org/jira/browse/XALANJ-2323
> Project: XalanJ2
> Issue Type: Bug
> Components: Serialization
> Affects Versions: 2.7
> Environment: All environments
> Reporter: Chad W. Gill
> Assigned To: Brian Minchau
> Attachments: jira2323.patch1.txt
>
>
> In ToHTMLSAXHandler the closeStartTag() incorrectly passes EmptyString to namespace and ElementName to localName of the ContentHandler.
> From org.apache.xml.serializer.ToHTMLSAXHandler :
> protected void closeStartTag() throws SAXException
> {
> m_elemContext.m_startTagOpen = false;
> // Now is time to send the startElement event
> m_saxHandler.startElement(
> EMPTYSTRING, <<<< Should this be m_elementURI ?
> m_elemContext.m_elementName, <<<< Should this be m_elementLocalName ?
> m_elemContext.m_elementName,
> m_attributes);
> m_attributes.clear();
> }
> This results in a ValidationException being thrown by Apache FOP DefaultHandler's startElement(). In this case, the namespace = "" (should be "http://www.w3.org/1999/XSL/Format") and the localName = "fo:root" (should be "root")
> From org.apache.fop.fo.FOTreeBuilder:
> public void startElement(String namespaceURI, String localName, String rawName,
> Attributes attlist) throws SAXException {
> /* the node found in the FO document */
> FONode foNode;
> PropertyList propertyList = null;
> // Check to ensure first node encountered is an fo:root
> if (rootFObj == null) {
> if (!namespaceURI.equals(FOElementMapping.URI)
> || !localName.equals("root")) {
> throw new ValidationException(
> "Error: First element must be the fo:root formatting object. "
> + "Found " + FONode.getNodeString(namespaceURI, localName)
> + " instead."
> + " Please make sure you're producing a valid XSL-FO document.");
> }.......
> This exception will untimately produce the following message:
> javax.xml.transform.TransformerException: java.lang.IllegalStateException: endElement() called for fo:root where there is no current element.
> ------- Here is a workaround -----------------
> In XALAN, the decision to use ToHTMLSAXHandler is made if the following is in the xslt file: <xsl:output version="1.0" method="html" encoding="UTF-8" indent="no"/>. If you change the method="html" to method="xml", XALAN will use ToXMLSAXHandler instead (which will correctly pass namespace and localName).
> FYI, The FO XSLT that I'm using was produced by Altova Stylevision.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org