You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Brecht Yperman (JIRA)" <ji...@apache.org> on 2011/04/18 15:48:05 UTC

[jira] [Updated] (AXIS2-5006) SoapElementImpl.copyContents skips child elements

     [ https://issues.apache.org/jira/browse/AXIS2-5006?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brecht Yperman updated AXIS2-5006:
----------------------------------

    Priority: Major  (was: Blocker)

Changed to major because I found a workaround.

This does not work:
public static void addVariables(Node parentNode,
            ServiceVariableMap variables) {
        if (parentNode != null && variables != null) {
            Document doc = parentNode.getOwnerDocument();
            Element variablesEl = doc.createElementNS(
                    XBI_VARIABLES_HEADER_NAMESPACE, XBI_VARIABLES_HEADER_NAME);
            variablesEl.setAttribute("continue", variables.isContinue() + "");

            for (ServiceVariable var : variables.values()) {
                Element variableEl = doc.createElementNS(
                        XBI_VARIABLES_HEADER_NAMESPACE,
                        XBI_VARIABLE_HEADER_NAME); 

                variablesEl.appendChild(variableEl);
            } 
			
			parentNode.appendChild(variablesEl);
        }
    }

This does:
public static void addVariables(Node parentNode,
            ServiceVariableMap variables) {
        if (parentNode != null && variables != null) {
            Document doc = parentNode.getOwnerDocument();
            Element variablesEl = doc.createElementNS(
                    XBI_VARIABLES_HEADER_NAMESPACE, XBI_VARIABLES_HEADER_NAME);
            variablesEl.setAttribute("continue", variables.isContinue() + "");
            
            variablesEl = (Element) parentNode.appendChild(variablesEl);

            for (ServiceVariable var : variables.values()) {
                Element variableEl = doc.createElementNS(
                        XBI_VARIABLES_HEADER_NAMESPACE,
                        XBI_VARIABLE_HEADER_NAME); 

                variablesEl.appendChild(variableEl);
            } 
        }
    }


> SoapElementImpl.copyContents skips child elements
> -------------------------------------------------
>
>                 Key: AXIS2-5006
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5006
>             Project: Axis2
>          Issue Type: Bug
>          Components: saaj
>    Affects Versions: 1.5.4
>            Reporter: Brecht Yperman
>
> When adding elements using appendChild, I lose elements
> It seems to boil down to
> == org.apache.axis2.saaj.SOAPElementImpl lines 936 - 940
> NodeList children = child.getChildNodes();        
>         for (int i = 0; i < children.getLength(); i++) {
>             Node node = children.item(i);
>             childEle.appendChild(node);
>         }
> == 
> The appended child seems to be removed from the original, causing children.getLength() to be smaller every iteration, causing elements to be missed.
> I did not experience this problem in 1.5

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

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org