You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "Grzegorz Kossakowski (JIRA)" <ji...@apache.org> on 2007/12/26 20:18:43 UTC

[jira] Created: (COCOON-2155) Parser produces redundant element attributes (namespace declarations) in a DOM while test-cases are executed

Parser produces redundant element attributes (namespace declarations) in a DOM while test-cases are executed
------------------------------------------------------------------------------------------------------------

                 Key: COCOON-2155
                 URL: https://issues.apache.org/jira/browse/COCOON-2155
             Project: Cocoon
          Issue Type: Bug
          Components: * Cocoon Core
    Affects Versions: 2.2-dev (Current SVN)
            Reporter: Grzegorz Kossakowski


Quoting Joerg:
"Just an explanation: A namespace declaration is not an attribute (even 
if it looks so) and that's why it should not end as such. The DOM 
produced by Cocoon is absolutely correct, the one by parsing expected 
document in the test case is not since it has both the namespace 
declaration AND an attribute xmlns:fi - which broke our test."
(http://article.gmane.org/gmane.text.xml.cocoon.devel/75975)

Also see this: http://article.gmane.org/gmane.text.xml.cocoon.devel/75974

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COCOON-2155) Failing test cases due to additional attributes from namespace declarations in a DOM from parser, but not from serializer

Posted by "Grzegorz Kossakowski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COCOON-2155?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Grzegorz Kossakowski updated COCOON-2155:
-----------------------------------------

    Attachment: COCOON-2155-cocoon-forms-impl.patch

Added missing start/endPrefixMapping calls in a code generating XML in Forms. Also removed work-arounds for a bug in Xalan that is fixed in 2.7.1 version.

> Failing test cases due to additional attributes from namespace declarations in a DOM from parser, but not from serializer
> -------------------------------------------------------------------------------------------------------------------------
>
>                 Key: COCOON-2155
>                 URL: https://issues.apache.org/jira/browse/COCOON-2155
>             Project: Cocoon
>          Issue Type: Bug
>          Components: * Cocoon Core
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Grzegorz Kossakowski
>         Attachments: COCOON-2155-cocoon-core.patch, COCOON-2155-cocoon-forms-impl.patch, COCOON-2155-parent-pom.patch
>
>
> Quoting Joerg:
> "Just an explanation: A namespace declaration is not an attribute (even 
> if it looks so) and that's why it should not end as such. The DOM 
> produced by Cocoon is absolutely correct, the one by parsing expected 
> document in the test case is not since it has both the namespace 
> declaration AND an attribute xmlns:fi - which broke our test."
> (http://article.gmane.org/gmane.text.xml.cocoon.devel/75975)
> Also see this: http://article.gmane.org/gmane.text.xml.cocoon.devel/75974

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COCOON-2155) Failing test cases due to additional attributes from namespace declarations in a DOM from parser, but not from serializer

Posted by "Grzegorz Kossakowski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COCOON-2155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12554680 ] 

Grzegorz Kossakowski commented on COCOON-2155:
----------------------------------------------

Thanks Joerg for reviewing my patches. I won't attach fixed patches but your suggestion must be taken into account when patches are applied, of course.

I'm don't like these superfluous declarations either but my opinion is that test-cases should always reflect in every detail behaviour of components they test. Current behaviour of tested components is to leave superfluous namespace declarations and this must be reflected in tests. If we decide to change that or not is separate case and I think we shouldn't mix them.

BTW. CIncludeTransformer removes it's own namespace declarations and leaves the rest so in this case I had to add namespace declaration to cinclude-input-* files because they are expected in the output files.

> Failing test cases due to additional attributes from namespace declarations in a DOM from parser, but not from serializer
> -------------------------------------------------------------------------------------------------------------------------
>
>                 Key: COCOON-2155
>                 URL: https://issues.apache.org/jira/browse/COCOON-2155
>             Project: Cocoon
>          Issue Type: Bug
>          Components: * Cocoon Core
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Grzegorz Kossakowski
>         Attachments: COCOON-2155-cocoon-core.patch, COCOON-2155-cocoon-forms-impl.patch, COCOON-2155-cocoon-template-impl.patch, COCOON-2155-parent-pom.patch
>
>
> Quoting Joerg:
> "Just an explanation: A namespace declaration is not an attribute (even 
> if it looks so) and that's why it should not end as such. The DOM 
> produced by Cocoon is absolutely correct, the one by parsing expected 
> document in the test case is not since it has both the namespace 
> declaration AND an attribute xmlns:fi - which broke our test."
> (http://article.gmane.org/gmane.text.xml.cocoon.devel/75975)
> Also see this: http://article.gmane.org/gmane.text.xml.cocoon.devel/75974

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COCOON-2155) Failing test cases due to additional attributes from namespace declarations in a DOM from parser, but not from serializer

Posted by "Grzegorz Kossakowski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COCOON-2155?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Grzegorz Kossakowski updated COCOON-2155:
-----------------------------------------

    Attachment: COCOON-2155-cocoon-template-impl.patch

Added missing namespace prefix declarations.

> Failing test cases due to additional attributes from namespace declarations in a DOM from parser, but not from serializer
> -------------------------------------------------------------------------------------------------------------------------
>
>                 Key: COCOON-2155
>                 URL: https://issues.apache.org/jira/browse/COCOON-2155
>             Project: Cocoon
>          Issue Type: Bug
>          Components: * Cocoon Core
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Grzegorz Kossakowski
>         Attachments: COCOON-2155-cocoon-core.patch, COCOON-2155-cocoon-forms-impl.patch, COCOON-2155-cocoon-template-impl.patch, COCOON-2155-parent-pom.patch
>
>
> Quoting Joerg:
> "Just an explanation: A namespace declaration is not an attribute (even 
> if it looks so) and that's why it should not end as such. The DOM 
> produced by Cocoon is absolutely correct, the one by parsing expected 
> document in the test case is not since it has both the namespace 
> declaration AND an attribute xmlns:fi - which broke our test."
> (http://article.gmane.org/gmane.text.xml.cocoon.devel/75975)
> Also see this: http://article.gmane.org/gmane.text.xml.cocoon.devel/75974

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COCOON-2155) Failing test cases due to additional attributes from namespace declarations in a DOM from parser, but not from serializer

Posted by "Grzegorz Kossakowski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COCOON-2155?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Grzegorz Kossakowski updated COCOON-2155:
-----------------------------------------

    Attachment: COCOON-2155-cocoon-core.patch

Added missing namespace prefix declarations in CIncludeTransformerTestCase.

> Failing test cases due to additional attributes from namespace declarations in a DOM from parser, but not from serializer
> -------------------------------------------------------------------------------------------------------------------------
>
>                 Key: COCOON-2155
>                 URL: https://issues.apache.org/jira/browse/COCOON-2155
>             Project: Cocoon
>          Issue Type: Bug
>          Components: * Cocoon Core
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Grzegorz Kossakowski
>         Attachments: COCOON-2155-cocoon-core.patch, COCOON-2155-parent-pom.patch
>
>
> Quoting Joerg:
> "Just an explanation: A namespace declaration is not an attribute (even 
> if it looks so) and that's why it should not end as such. The DOM 
> produced by Cocoon is absolutely correct, the one by parsing expected 
> document in the test case is not since it has both the namespace 
> declaration AND an attribute xmlns:fi - which broke our test."
> (http://article.gmane.org/gmane.text.xml.cocoon.devel/75975)
> Also see this: http://article.gmane.org/gmane.text.xml.cocoon.devel/75974

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COCOON-2155) Failing test cases due to additional attributes from namespace declarations in a DOM from parser, but not from serializer

Posted by "Grzegorz Kossakowski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COCOON-2155?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Grzegorz Kossakowski updated COCOON-2155:
-----------------------------------------

    Attachment: COCOON-2155-parent-pom.patch

I have taken a closer look at our test-cases after upgrading (locally) to Xalan 2.7.1. Fix of bug in Xalan revealed that we had some test-cases slightly broken. I fixed all of them I could found so all test-cases passed again. Unfortunately, I cannot commit these fixes because there Xalan 2.7.1 is not available on Maven repository at the moment.

Therefore I decided to attach my fixes as patches to this issue.

First patch consist only of change to parent pom to be applied when Xalan 2.1.7 is available on Maven repository.

> Failing test cases due to additional attributes from namespace declarations in a DOM from parser, but not from serializer
> -------------------------------------------------------------------------------------------------------------------------
>
>                 Key: COCOON-2155
>                 URL: https://issues.apache.org/jira/browse/COCOON-2155
>             Project: Cocoon
>          Issue Type: Bug
>          Components: * Cocoon Core
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Grzegorz Kossakowski
>         Attachments: COCOON-2155-cocoon-core.patch, COCOON-2155-parent-pom.patch
>
>
> Quoting Joerg:
> "Just an explanation: A namespace declaration is not an attribute (even 
> if it looks so) and that's why it should not end as such. The DOM 
> produced by Cocoon is absolutely correct, the one by parsing expected 
> document in the test case is not since it has both the namespace 
> declaration AND an attribute xmlns:fi - which broke our test."
> (http://article.gmane.org/gmane.text.xml.cocoon.devel/75975)
> Also see this: http://article.gmane.org/gmane.text.xml.cocoon.devel/75974

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COCOON-2155) Failing test cases due to additional attributes from namespace declarations in a DOM from parser, but not from serializer

Posted by "Jörg Heinicke (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COCOON-2155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12555463#action_12555463 ] 

Jörg Heinicke commented on COCOON-2155:
---------------------------------------

> I'm don't like these superfluous declarations either but my opinion is that test-cases should always reflect in every detail behaviour of components they test.
> Current behaviour of tested components is to leave superfluous namespace declarations and this must be reflected in tests.

My point was that it is no error if the component's behavior changes in this regard. But I really don't have a strong opinion on this and I am absolutely ok with the way you did it.

> Failing test cases due to additional attributes from namespace declarations in a DOM from parser, but not from serializer
> -------------------------------------------------------------------------------------------------------------------------
>
>                 Key: COCOON-2155
>                 URL: https://issues.apache.org/jira/browse/COCOON-2155
>             Project: Cocoon
>          Issue Type: Bug
>          Components: * Cocoon Core
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Grzegorz Kossakowski
>         Attachments: COCOON-2155-cocoon-core.patch, COCOON-2155-cocoon-forms-impl.patch, COCOON-2155-cocoon-template-impl.patch, COCOON-2155-parent-pom.patch
>
>
> Quoting Joerg:
> "Just an explanation: A namespace declaration is not an attribute (even 
> if it looks so) and that's why it should not end as such. The DOM 
> produced by Cocoon is absolutely correct, the one by parsing expected 
> document in the test case is not since it has both the namespace 
> declaration AND an attribute xmlns:fi - which broke our test."
> (http://article.gmane.org/gmane.text.xml.cocoon.devel/75975)
> Also see this: http://article.gmane.org/gmane.text.xml.cocoon.devel/75974

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COCOON-2155) Failing test cases due to additional attributes from namespace declarations in a DOM from parser, but not from serializer

Posted by "Jörg Heinicke (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COCOON-2155?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jörg Heinicke updated COCOON-2155:
----------------------------------

    Summary: Failing test cases due to additional attributes from namespace declarations in a DOM from parser, but not from serializer  (was: Parser produces redundant element attributes (namespace declarations) in a DOM while test-cases are executed)

> Failing test cases due to additional attributes from namespace declarations in a DOM from parser, but not from serializer
> -------------------------------------------------------------------------------------------------------------------------
>
>                 Key: COCOON-2155
>                 URL: https://issues.apache.org/jira/browse/COCOON-2155
>             Project: Cocoon
>          Issue Type: Bug
>          Components: * Cocoon Core
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Grzegorz Kossakowski
>
> Quoting Joerg:
> "Just an explanation: A namespace declaration is not an attribute (even 
> if it looks so) and that's why it should not end as such. The DOM 
> produced by Cocoon is absolutely correct, the one by parsing expected 
> document in the test case is not since it has both the namespace 
> declaration AND an attribute xmlns:fi - which broke our test."
> (http://article.gmane.org/gmane.text.xml.cocoon.devel/75975)
> Also see this: http://article.gmane.org/gmane.text.xml.cocoon.devel/75974

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COCOON-2155) Failing test cases due to additional attributes from namespace declarations in a DOM from parser, but not from serializer

Posted by "Jörg Heinicke (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COCOON-2155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12554637 ] 

Jörg Heinicke commented on COCOON-2155:
---------------------------------------

Some c&p errors:

Index: src/main/java/org/apache/cocoon/forms/datatype/FlowJXPathSelectionList.java
===================================================================
--- src/main/java/org/apache/cocoon/forms/datatype/FlowJXPathSelectionList.java	(revision 606943)
+++ src/main/java/org/apache/cocoon/forms/datatype/FlowJXPathSelectionList.java	(working copy)
@@ -116,6 +116,7 @@
         }
 
         // Start the selection-list
+        contentHandler.startPrefixMapping(FormsConstants.INSTANCE_PREFIX, FormsConstants.INSTANCE_PREFIX);
         contentHandler.startElement(FormsConstants.INSTANCE_NS, SELECTION_LIST_EL, FormsConstants.INSTANCE_PREFIX_COLON + SELECTION_LIST_EL, XMLUtils.EMPTY_ATTRIBUTES);
         if( this.nullable ) {
             final AttributesImpl voidAttrs = new AttributesImpl(  );

The second INSTANCE_PREFIX must be INSTANCE_NS.

Index: src/main/java/org/apache/cocoon/forms/datatype/EnumSelectionList.java
===================================================================
--- src/main/java/org/apache/cocoon/forms/datatype/EnumSelectionList.java	(revision 606943)
+++ src/main/java/org/apache/cocoon/forms/datatype/EnumSelectionList.java	(working copy)
@@ -96,6 +96,8 @@
                                     Locale locale)
     throws SAXException {
         try {
+            contentHandler.startPrefixMapping(FormsConstants.INSTANCE_PREFIX, FormsConstants.INSTANCE_NS);
+            contentHandler.startPrefixMapping(FormsConstants.I18N_PREFIX, FormsConstants.INSTANCE_NS);
             contentHandler.startElement(FormsConstants.INSTANCE_NS, SELECTION_LIST_EL, FormsConstants.INSTANCE_PREFIX_COLON + SELECTION_LIST_EL, XMLUtils.EMPTY_ATTRIBUTES);
             // Create void element
             if (nullable) {

The second INSTANCE_NS must be I18N_NS.

Regarding adding namespace declarations to the XML documents in cocoon-core and cocoon-template: This should not be necessary as they are really superfluous. I know though that Cocoon leaves superfluous namespace declarations in the documents. Instead of relying on the behavior that the actual Cocoon components always produce these superfluous namespace declarations it is probably better to remove them. This should be possible using RedundantNamespacesFilter.

> Failing test cases due to additional attributes from namespace declarations in a DOM from parser, but not from serializer
> -------------------------------------------------------------------------------------------------------------------------
>
>                 Key: COCOON-2155
>                 URL: https://issues.apache.org/jira/browse/COCOON-2155
>             Project: Cocoon
>          Issue Type: Bug
>          Components: * Cocoon Core
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Grzegorz Kossakowski
>         Attachments: COCOON-2155-cocoon-core.patch, COCOON-2155-cocoon-forms-impl.patch, COCOON-2155-cocoon-template-impl.patch, COCOON-2155-parent-pom.patch
>
>
> Quoting Joerg:
> "Just an explanation: A namespace declaration is not an attribute (even 
> if it looks so) and that's why it should not end as such. The DOM 
> produced by Cocoon is absolutely correct, the one by parsing expected 
> document in the test case is not since it has both the namespace 
> declaration AND an attribute xmlns:fi - which broke our test."
> (http://article.gmane.org/gmane.text.xml.cocoon.devel/75975)
> Also see this: http://article.gmane.org/gmane.text.xml.cocoon.devel/75974

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.