/** * Set the name and namespace URI for a <structure> or <collection> binding component. * * @param qname qualified name to be set (<code>null</code> if none) * @param holder binding containing the structure or collection definition * @param struct binding component */ private static void setName(QName qname, BindingHolder holder, StructureElementBase struct) { if (qname != null) { if (struct.getName() != null) { throw new IllegalStateException("Internal error - trying to overwrite name '" + struct.getName() + "' with '" + qname.getName() + '\''); } String name = qname.getName(); String uri = qname.getUri(); if (name.charAt(0) == '{') { int split = name.indexOf('}'); uri = name.substring(1, split); name = name.substring(split+1); } struct.setName(name); holder.addNamespaceUsage(uri); if (!Utility.safeEquals(uri, holder.getElementDefaultNamespace())) { struct.setUri(uri); } } }
/** * Set the name and namespace URI for a <value> binding component. The value style must be set before making this * call, since element and attribute elements are handled differently. * * @param qname qualified name to be set (<code>null</code> if none) * @param holder binding containing the value definition * @param value binding component */ private static void setName(QName qname, BindingHolder holder, ValueElement value) { if (qname != null) { if (value.getName() != null) { throw new IllegalStateException("Internal error - trying to overwrite name '" + value.getName() + "' with '" + qname.getName() + '\''); } value.setName(qname.getName()); String uri = qname.getUri(); int style = value.getStyle(); if (style == NestingAttributes.ATTRIBUTE_STYLE) { if (uri != null) { holder.addNamespaceUsage(uri); } value.setUri(uri); } else if (style == NestingAttributes.ELEMENT_STYLE) { holder.addNamespaceUsage(uri); if (!Utility.safeEquals(uri, holder.getElementDefaultNamespace())) { value.setUri(uri); } } } }
/** * Set the name and namespace URI for a concrete <mapping> binding component. This is the same logic as used in * the {@link StructureClassHolder} equivalent. * * @param qname qualified name to be set (<code>null</code> if none) * @param mapping concrete mapping definition * @param holder binding containing the mapping */ private void setName(QName qname, MappingElementBase mapping, BindingHolder holder) { if (qname != null) { String name = qname.getName(); mapping.setName(name); String uri = qname.getUri(); holder.addNamespaceUsage(uri); if (!Utility.safeEquals(uri, holder.getElementDefaultNamespace())) { mapping.setUri(uri); } } }
if (memb != null) { struct.setName(memb.getXmlName()); hold.addNamespaceUsage(hold.getNamespace()); hold.addNamespaceUsage(hold.getNamespace());
if ((cust.isWrapCollections() || memb.isElementForced()) && name != null) { coll.setName(name); hold.addNamespaceUsage(hold.getNamespace()); hold.addNamespaceUsage(hold.getNamespace());
hold.addNamespaceUsage(hold.getNamespace()); struct.setCreateType(custom.getCreateType()); struct.setFactoryName(custom.getFactoryMethod()); hold.addNamespaceUsage(hold.getNamespace()); fillStructure(custom, null, null, struct, hold); coll.addChild(struct);