engines/servicemix-cxf-se/src/main/java/org/apache/servicemix/cxfse/SchemaUtil.java [91:150]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    private void extractSchema(Definition def, SchemaCollection schemaCol, List<SchemaInfo> schemaInfos) {
        Types typesElement = def.getTypes();
        if (typesElement != null) {
            int schemaCount = 1;
            for (Object obj : typesElement.getExtensibilityElements()) {
                org.w3c.dom.Element schemaElem = null;
                if (obj instanceof Schema) {
                    Schema schema = (Schema)obj;
                    schemaElem = schema.getElement();
                } else if (obj instanceof UnknownExtensibilityElement) {
                    org.w3c.dom.Element elem = ((UnknownExtensibilityElement)obj).getElement();
                    if (elem.getLocalName().equals("schema")) {
                        schemaElem = elem;
                    }
                }
                if (schemaElem != null) {
                    synchronized (schemaElem.getOwnerDocument()) {
                        //for (Object prefix : def.getNamespaces().keySet()) {
                        Map<String, String> nameSpaces = CastUtils.cast(def.getNamespaces());
                        for (Entry<String, String> ent : nameSpaces.entrySet()) {
                            String prefix = ent.getKey();
                            String ns = nameSpaces.get(prefix);
                            if ("".equals(prefix)) {
                                if (!schemaElem.hasAttribute("xmlns")) {
                                    Attr attr = 
                                        schemaElem.getOwnerDocument()
                                            .createAttributeNS(javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI, 
                                                               "xmlns");
                                    attr.setValue(ns);
                                    schemaElem.setAttributeNodeNS(attr);
                                }
                            } else if (!schemaElem.hasAttribute("xmlns:" + prefix)) {
                                String namespace = javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
                                Attr attr = 
                                    schemaElem.getOwnerDocument().createAttributeNS(namespace, 
                                                                                    "xmlns:" + prefix);
                                attr.setValue(ns);
                                schemaElem.setAttributeNodeNS(attr);
                            }
                        }
                        String systemId = def.getDocumentBaseURI() + "#types" + schemaCount;
    
                        schemaCol.setBaseUri(def.getDocumentBaseURI());
                        CatalogXmlSchemaURIResolver schemaResolver =
                            new CatalogXmlSchemaURIResolver(bus);
                        schemaCol.setSchemaResolver(schemaResolver);
                        
                        XmlSchema xmlSchema = schemaCol.read(schemaElem, systemId);
                        catalogResolved.putAll(schemaResolver.getResolvedMap());
                        SchemaInfo schemaInfo = new SchemaInfo(xmlSchema.getTargetNamespace());
                        schemaInfo.setSchema(xmlSchema);
                        schemaInfo.setSystemId(systemId);
                        schemaInfo.setElement(schemaElem);
                        schemaInfos.add(schemaInfo);
                        schemaCount++;
                    }
                }
            }
        }
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/SchemaUtil.java [91:150]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    private void extractSchema(Definition def, SchemaCollection schemaCol, List<SchemaInfo> schemaInfos) {
        Types typesElement = def.getTypes();
        if (typesElement != null) {
            int schemaCount = 1;
            for (Object obj : typesElement.getExtensibilityElements()) {
                org.w3c.dom.Element schemaElem = null;
                if (obj instanceof Schema) {
                    Schema schema = (Schema)obj;
                    schemaElem = schema.getElement();
                } else if (obj instanceof UnknownExtensibilityElement) {
                    org.w3c.dom.Element elem = ((UnknownExtensibilityElement)obj).getElement();
                    if (elem.getLocalName().equals("schema")) {
                        schemaElem = elem;
                    }
                }
                if (schemaElem != null) {
                    synchronized (schemaElem.getOwnerDocument()) {
                        //for (Object prefix : def.getNamespaces().keySet()) {
                        Map<String, String> nameSpaces = CastUtils.cast(def.getNamespaces());
                        for (Entry<String, String> ent : nameSpaces.entrySet()) {
                            String prefix = ent.getKey();
                            String ns = nameSpaces.get(prefix);
                            if ("".equals(prefix)) {
                                if (!schemaElem.hasAttribute("xmlns")) {
                                    Attr attr = 
                                        schemaElem.getOwnerDocument()
                                            .createAttributeNS(javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI, 
                                                               "xmlns");
                                    attr.setValue(ns);
                                    schemaElem.setAttributeNodeNS(attr);
                                }
                            } else if (!schemaElem.hasAttribute("xmlns:" + prefix)) {
                                String namespace = javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
                                Attr attr = 
                                    schemaElem.getOwnerDocument().createAttributeNS(namespace, 
                                                                                    "xmlns:" + prefix);
                                attr.setValue(ns);
                                schemaElem.setAttributeNodeNS(attr);
                            }
                        }
                        String systemId = def.getDocumentBaseURI() + "#types" + schemaCount;
    
                        schemaCol.setBaseUri(def.getDocumentBaseURI());
                        CatalogXmlSchemaURIResolver schemaResolver =
                            new CatalogXmlSchemaURIResolver(bus);
                        schemaCol.setSchemaResolver(schemaResolver);
                        
                        XmlSchema xmlSchema = schemaCol.read(schemaElem, systemId);
                        catalogResolved.putAll(schemaResolver.getResolvedMap());
                        SchemaInfo schemaInfo = new SchemaInfo(xmlSchema.getTargetNamespace());
                        schemaInfo.setSchema(xmlSchema);
                        schemaInfo.setSystemId(systemId);
                        schemaInfo.setElement(schemaElem);
                        schemaInfos.add(schemaInfo);
                        schemaCount++;
                    }
                }
            }
        }
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



