[ 
http://issues.apache.org/jira/browse/XALANJ-2323?page=comments#action_12445700 
] 
            
Brian Minchau commented on XALANJ-2323:
---------------------------------------

Chad,
the corresponding code in ToXMLSAXHandler.java, in closeStartTag() has this:
    m_saxHandler.startElement(uri, localName, m_elemContext.m_elementName, 
m_attributes);

which clearly has a uri, and a local name that may differ from a qname (and of  
course the attributes).

So I think if you try out the patch applied, which avoid the ToHTMLSAXHandler 
class alltogether you will find that your problem is fixed.  Please confirm 
that the patch works for you ASAP, which will improve its chances of getting 
into the upcoming 2.7.1 release (last release was about 15 months ago).


> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to