private void findNamespaces()

in blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/parser/Parser.java [283:321]


    private void findNamespaces(Set<URI> namespaces, Map<String, String> locations, Node node) {
        if (node instanceof Element || node instanceof Attr) {
            String ns = node.getNamespaceURI();
            if ("http://www.w3.org/2001/XMLSchema-instance".equals(ns)
                    && node instanceof Attr
                    && "schemaLocation".equals(node.getLocalName())) {
                String val = ((Attr) node).getValue();
                List<String> locs = new ArrayList<String>(Arrays.asList(val.split("\\s+")));
                locs.remove("");
                for (int i = 0; i < locs.size() / 2; i++) {
                    locations.put(locs.get(i * 2), locs.get(i * 2 + 1));
                }
            } else if (ns != null && !isBlueprintNamespace(ns) && !isIgnorableAttributeNamespace(ns)) {
                namespaces.add(URI.create(ns));
            } else if (ns == null && //attributes from blueprint are unqualified as per schema.
                       node instanceof Attr &&
                       SCOPE_ATTRIBUTE.equals(node.getNodeName()) &&
                       ((Attr)node).getOwnerElement() != null && //should never occur from parsed doc.
                       BLUEPRINT_NAMESPACE.equals(((Attr)node).getOwnerElement().getNamespaceURI()) &&
                       BEAN_ELEMENT.equals(((Attr)node).getOwnerElement().getLocalName()) ){
                //Scope attribute is special case, as may contain namespace usage within its value.
                
                URI scopeNS = getNamespaceForAttributeValue(node);
                if(scopeNS!=null){
                    namespaces.add(scopeNS);
                }
            }
        }
        NamedNodeMap nnm = node.getAttributes();
        if(nnm!=null){
            for(int i = 0; i< nnm.getLength() ; i++){
                findNamespaces(namespaces, locations, nnm.item(i));
            }
        }
        NodeList nl = node.getChildNodes();
        for (int i = 0; i < nl.getLength(); i++) {
            findNamespaces(namespaces, locations, nl.item(i));
        }
    }