< prev index next >

jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StructureLoader.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 29,39 **** --- 29,41 ---- import java.util.HashMap; import java.util.Map; import javax.xml.namespace.QName; + import com.sun.xml.internal.bind.Util; import com.sun.xml.internal.bind.api.AccessorException; + import com.sun.xml.internal.bind.api.JAXBRIContext; import com.sun.xml.internal.bind.v2.WellKnownNamespace; import com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl; import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; import com.sun.xml.internal.bind.v2.runtime.JaxBeanInfo; import com.sun.xml.internal.bind.v2.runtime.property.AttributeProperty;
*** 229,245 **** } @Override public void childElement(UnmarshallingContext.State state, TagName arg) throws SAXException { ChildLoader child = childUnmarshallers.get(arg.uri,arg.local); if (child == null) { child = catchAll; ! if (child==null) { super.childElement(state,arg); return; } } state.setLoader(child.loader); state.setReceiver(child.receiver); } --- 231,262 ---- } @Override public void childElement(UnmarshallingContext.State state, TagName arg) throws SAXException { ChildLoader child = childUnmarshallers.get(arg.uri,arg.local); + if(child == null) { + Boolean backupWithParentNamespace = ((JAXBContextImpl) state.getContext().getJAXBContext()).backupWithParentNamespace; + backupWithParentNamespace = backupWithParentNamespace != null + ? backupWithParentNamespace + : Boolean.parseBoolean(Util.getSystemProperty(JAXBRIContext.BACKUP_WITH_PARENT_NAMESPACE)); + if ((beanInfo != null) && (beanInfo.getTypeNames() != null) && backupWithParentNamespace) { + Iterator<?> typeNamesIt = beanInfo.getTypeNames().iterator(); + QName parentQName = null; + if ((typeNamesIt != null) && (typeNamesIt.hasNext()) && (catchAll == null)) { + parentQName = (QName) typeNamesIt.next(); + String parentUri = parentQName.getNamespaceURI(); + child = childUnmarshallers.get(parentUri, arg.local); + } + } if (child == null) { child = catchAll; ! if(child==null) { super.childElement(state,arg); return; } } + } state.setLoader(child.loader); state.setReceiver(child.receiver); }
< prev index next >