You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Chad W. Gill (JIRA)" <xa...@xml.apache.org> on 2006/10/06 16:41:19 UTC

[jira] Created: (XALANJ-2323) closeStartTag() in ToHTMLSAXHandler does not pass localName or namespace to the ContentHandler. Results in ValidationException in Apache FOP.

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


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


[jira] Resolved: (XALANJ-2323) closeStartTag() in ToHTMLSAXHandler does not pass localName or namespace to the ContentHandler. Results in ValidationException in Apache FOP.

Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2323?page=all ]

Brian Minchau resolved XALANJ-2323.
-----------------------------------

    Fix Version/s: Latest Development Code
       Resolution: Fixed

I applied to the patch to the code base.

> 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
>             Fix For: Latest Development Code
>
>         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


[jira] Commented: (XALANJ-2323) closeStartTag() in ToHTMLSAXHandler does not pass localName or namespace to the ContentHandler. Results in ValidationException in Apache FOP.

Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
    [ http://issues.apache.org/jira/browse/XALANJ-2323?page=comments#action_12443018 ] 
            
Brian Minchau commented on XALANJ-2323:
---------------------------------------

ToTextSAXHandler consumes all startElement  and endElement events because it "knows" that the final stream serializer will consume them rather than emit something for them into the stream of bytes. This was an optimization. ToHTMLSAXHandler  does similar. However this is in violation of JAXP 1.3, as the events ought to be passed further down the line (the user may have their own ContentHandler to accept SAX events for serializing text output).

Per the JIRA triage meeting on Oct 16, 2005:
Suggest that ToHTMLSAXHandler and ToTextSAXHandler be deprecated, and that only ToXMLSAXHandler be used in the future, which will resolve this particular issue.

> 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
>
> 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


[jira] Commented: (XALANJ-2323) closeStartTag() in ToHTMLSAXHandler does not pass localName or namespace to the ContentHandler. Results in ValidationException in Apache FOP.

Posted by "Henry Zongaro (JIRA)" <xa...@xml.apache.org>.
    [ http://issues.apache.org/jira/browse/XALANJ-2323?page=comments#action_12441760 ] 
            
Henry Zongaro commented on XALANJ-2323:
---------------------------------------

The ToHTMLSAXHandler and ToTextSAXHandler classes owe their existence to some ambiguity in the JAXP 1.1 and 1.2 specifications.  It wasn't clear whether the various output properties specified in <xsl:output> or through Transformer.setOutputProperty and related methods had an effect only on StreamResult or on all three standard kinds of Result objects.  Some of the output properties can have no meaningful effect on SAXResult or DOMResult objects, but others can, so we (I think I was the one who really pushed for this interpretation) assumed that it was the intent of the specification that they should have an effect.

We were wrong.  ToHTMLSAXHandler and ToTextSAXHandler should go away.  JAXP 1.3 makes that clear under "Result Tree Serialization":

"Serialization of the result tree to a stream can be controlled with the javax.xml.transform.Transformer.setOutputProperties [ Method setOutputProperties(java.util.Properties)] and the javax.xml.transform.Transformer.setOutputProperty [ Method setOutputProperty(java.lang.String, java.lang.String)] methods. These properties only apply to stream results, they have no effect when the result is a DOM tree or SAX event stream."

> 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
>
> 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


[jira] Assigned: (XALANJ-2323) closeStartTag() in ToHTMLSAXHandler does not pass localName or namespace to the ContentHandler. Results in ValidationException in Apache FOP.

Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
     [ 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


[jira] Commented: (XALANJ-2323) closeStartTag() in ToHTMLSAXHandler does not pass localName or namespace to the ContentHandler. Results in ValidationException in Apache FOP.

Posted by "Chad W. Gill (JIRA)" <xa...@xml.apache.org>.
    [ http://issues.apache.org/jira/browse/XALANJ-2323?page=comments#action_12450164 ] 
            
Chad W. Gill commented on XALANJ-2323:
--------------------------------------

It appears the patch applied to TransletOutputHandlerFactory works.  Avoiding the use of ToHTMLSAXHandler / ToTextSAXHandler and always using ToXMLSAXHandler fixes this issue. 

Thanks.

> 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


[jira] Commented: (XALANJ-2323) closeStartTag() in ToHTMLSAXHandler does not pass localName or namespace to the ContentHandler. Results in ValidationException in Apache FOP.

Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
    [ 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: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Commented: (XALANJ-2323) closeStartTag() in ToHTMLSAXHandler does not pass localName or namespace to the ContentHandler. Results in ValidationException in Apache FOP.

Posted by "Yash Talwar (JIRA)" <xa...@xml.apache.org>.
    [ http://issues.apache.org/jira/browse/XALANJ-2323?page=comments#action_12450522 ] 
            
Yash Talwar commented on XALANJ-2323:
-------------------------------------

I have reviewed the patch jira2323.patch1.txt .  The patch looks good to me.  
I approve.

Thanks!

Yash

> 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