Skip to content

Commit

Permalink
Fallback to node name if not local name is available
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Läubrich committed Jul 20, 2024
1 parent b7d1ff7 commit 0f831ec
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import org.w3c.dom.Node;
import org.xml.sax.SAXException;

import java.util.Objects;

import javax.xml.namespace.QName;
import javax.xml.validation.Schema;

Expand Down Expand Up @@ -178,7 +180,7 @@ public XmlNode updateXML(Object jaxbObject, XmlNode xmlNode) throws JAXBExceptio
// the marshalling successful.
JaxBeanInfo bi = context.getBeanInfo(jaxbObject, true);
if(!bi.isElement())
jaxbObject = new JAXBElement(new QName(e.getNamespaceURI(),e.getLocalName()),bi.jaxbType,jaxbObject);
jaxbObject = new JAXBElement(new QName(e.getNamespaceURI(),Objects.requireNonNullElse(e.getLocalName(), e.getNodeName()),bi.jaxbType,jaxbObject);


getMarshaller().marshal(jaxbObject,p);
Expand Down

0 comments on commit 0f831ec

Please sign in to comment.