Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

marshalling does not apply defaultNamespaceRemap setting to nested elements #1715

Closed
lukasj opened this issue Jun 3, 2023 · 1 comment · Fixed by #1716
Closed

marshalling does not apply defaultNamespaceRemap setting to nested elements #1715

lukasj opened this issue Jun 3, 2023 · 1 comment · Fixed by #1716

Comments

@lukasj
Copy link
Member

lukasj commented Jun 3, 2023

When marshalling GeneralAddress with nested xml element and having org.glassfish.jaxb.defaultNamespaceRemap property set to a custom value, ie http://test.com/ns, nested element is being put to the default namespace while the root one is put to the custom one. Expectation is that both elements appear in the same namespace.

    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "")
    @XmlRootElement(name = "generalAddress")
    public static class GeneralAddress implements Serializable {

        private final static long serialVersionUID = 1L;
        protected Address address;

        public Address getAddress() {
            return address;
        }

        public void setAddress(Address value) {
            this.address = value;
        }

    }

    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "")
    @XmlRootElement(name = "address")
    public static class Address implements Serializable {

        private final static long serialVersionUID = 1L;
        protected String list;

        public String getList() {
            return list;
        }

        public void setList(String value) {
            this.list = value;
        }

    }
lukasj added a commit to lukasj/jaxb-ri that referenced this issue Jun 3, 2023
…etting to nested elements

Signed-off-by: Lukas Jungmann <[email protected]>
lukasj added a commit to lukasj/jaxb-ri that referenced this issue Jun 3, 2023
…setting to nested elements

Signed-off-by: Lukas Jungmann <[email protected]>
lukasj added a commit to lukasj/jaxb-ri that referenced this issue Jun 3, 2023
…setting to nested elements

Signed-off-by: Lukas Jungmann <[email protected]>
lukasj added a commit that referenced this issue Jun 3, 2023
lukasj added a commit to lukasj/jaxb-ri that referenced this issue Oct 6, 2023
lukasj added a commit to lukasj/jaxb-ri that referenced this issue Oct 6, 2023
lukasj added a commit that referenced this issue Oct 6, 2023
@MaximValeev
Copy link

MaximValeev commented Oct 30, 2023

so what is the correct behaviour? For now in version jaxb-runtime-4.0.3 nested elements don't inherit the root element namespace even if i don't use defaultNamespaceRemap .

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {

})
@XmlRootElement(name = "ResponseType", namespace = "http://www.anyurl.com/wsdl/")
public class ResponseType {

    @XmlElement(required = true)
    protected String status;
    @XmlElement(required = true)
    protected String message;

Status and message will get "" namespace instead of XmlRootElement's namespace. Is it ok?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants