--- Namespaces ---
543879
function namespaceBoundary(namespace, line) {
      // Demarcate a namespace "boundary" to build up an array of namespace line
      // "ranges" to be able to find which namespace a piece of code belongs to.
      if (currentNamespaceRange) {
        namespaceRanges.push(currentNamespaceRange);
      }
      if (namespace) {
        currentNamespaceRange = {
          name: namespace,
          line: line
        };
      }
    }
811042
public void updateNamespaces(Document document) {
	Namespace rootNamespace = Namespace.gatherNamespaces(document);
	document.setNamespace(rootNamespace);
	for (org.openprovenance.prov.model.Bundle bu: utils.getBundle(document)) {
	    Namespace ns=bu.getNamespace();
	    if (ns!=null) {
		ns.setParent(rootNamespace);
	    } else {
		ns=new Namespace();
		ns.setParent(rootNamespace);
		bu.setNamespace(ns);
	    }
	}
    }
246977
public static Set<String> getNamespaces(InputSource source) throws ParserConfigurationException, SAXException, IOException {
        XmlNamespaceFinder finder = createNamespaceFinder();
        Set<String> answer = finder.parseContents(source);
        if (factory == null) {
            factory = finder.getFactory();
        }
        return answer;
    }
1117297
def _add_namespaces(self):
        
        self.doc.add_namespace(NIDM)
        self.doc.add_namespace(NIIRI)
        self.doc.add_namespace(CRYPTO)
        self.doc.add_namespace(DCT)
        self.doc.add_namespace(DC)
        self.doc.add_namespace(NFO)
        self.doc.add_namespace(OBO)
        self.doc.add_namespace(SCR)
        self.doc.add_namespace(NIF)
1113862
public void addNamespace(final MongoNamespace namespace) {
    this.instanceLock.writeLock().lock();
    try {
      if (this.nsStreamers.containsKey(namespace)) {
        return;
      }
      final NamespaceChangeStreamListener streamer =
          new NamespaceChangeStreamListener(
              namespace,
              instanceConfig.getNamespaceConfig(namespace),
              service,
              networkMonitor,
              authMonitor,
              getLockForNamespace(namespace));
      this.nsStreamers.put(namespace, streamer);
    } finally {
      this.instanceLock.writeLock().unlock();
    }
  }
859404
private void initNamespaces(){
		Map<Integer, String> namespaceMap = new HashMap<Integer,String>();
		try{
			int b = read();

			this.keywords.reset();
			StringBuilder buffer = null;

			while (b != -1) {
//				System.out.print((char)b);

				if (buffer != null) {
					buffer.append((char) b);
				}

				if (this.keywords.check((char) b)) {
					switch (this.keywords.getValue()) {

						case KEY_START_NAMESPACES:
							buffer = new StringBuilder(WikipediaXMLKeys.KEY_START_NAMESPACES.getKeyword());
							break;

						case KEY_END_NAMESPACES:
							DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
							factory.setIgnoringElementContentWhitespace(true);
							Document namespaces = factory.newDocumentBuilder().parse(new InputSource(new StringReader(buffer.toString())));


							NodeList nsList = namespaces.getChildNodes().item(0).getChildNodes();

							for (int i = 0; i < nsList.getLength(); i++) {
								Node curNamespace = nsList.item(i);

								//get the prefix for the current namespace
								String prefix = curNamespace.getTextContent().trim();
								if(!prefix.isEmpty()){
									NamedNodeMap nsAttributes = curNamespace.getAttributes();
									String namespace = nsAttributes.getNamedItem("key").getTextContent();
									namespaceMap.put(Integer.parseInt(namespace), prefix);
								}
							}

					    buffer = null;
						articleFilter.initializeNamespaces(namespaceMap);
						return; //init done

					}

					this.keywords.reset();
				}

				b=read();
			}
		}catch(IOException e){
			System.err.println("Error reading namespaces from xml dump.");
		}catch(ParserConfigurationException e){
			System.err.println("Error parsing namespace data.");
		}catch(SAXException e){
			System.err.println("Error parsing namespace data.");
		}
	}
1186265
function verifyNamespace(namespace) {
	if (namespace && typeof namespace !== 'string') {
		const msg = util.format('Namespace must be a non-empty string: %j', namespace);
		logger.error('verifyNamespace:', msg);
		throw new Error(msg);
	}
}
1337277
private void parseNamespaceDefinitions(BeanDefinitionBuilder builder, Element element) {
        Map<String, String> namespaces = new LinkedHashMap<String, String>();
        for (Element namespace : DomUtils.getChildElementsByTagName(element, "namespace")) {
            namespaces.put(namespace.getAttribute("prefix"), namespace.getAttribute("uri"));
        }

        if (!namespaces.isEmpty()) {
            builder.addPropertyValue("namespaceMappings", namespaces);
        }
    }
183477
def namespaces ns = "root", cn = "__Namespace"
    result = []
    each_instance( ns, cn ) do |inst|
      name = "#{ns}/#{inst.Name}"
      result << name
      result.concat namespaces name, cn
    end
    result.uniq
  end
579068
def namespace(self, value):
        
        if not isinstance(value, str):
            raise ValueError("Namespace must be a string")
        self._namespace = value
1040919
public boolean containsNamespace(String ns)
    {
        return _namespace.equals(ns) || (_aliasNamespace != null && _aliasNamespace.equals(ns));
    }
601653
public synchronized void refreshNamespaces() {
		/*
		 * cache namespaces
		 */
		if (this.namespaceCache == null) {
			this.namespaceCache = new TreeMap<String, Namespace>();
			Node[] nodes = client.getNodes();
			for (Node node : nodes) {
				try {
					String namespaceString = Info.request(getInfoPolicy(), node, "namespaces");
					if (!namespaceString.isEmpty()) {
						String[] namespaceList = namespaceString.split(";");
						for (String namespace : namespaceList) {
							Namespace ns = this.namespaceCache.get(namespace);
							if (ns == null) {
								ns = new Namespace(namespace);
								this.namespaceCache.put(namespace, ns);
							}
							refreshNamespaceData(node, ns);
						}
					}
				} catch (AerospikeException e) {
					log.error("Error geting Namespaces ", e);
				}

			}
		}
	}
387676
function Namespace(server, name){
  this.name = name;
  this.server = server;
  this.sockets = {};
  this.connected = {};
  this.fns = [];
  this.ids = 0;
  this.rooms = [];
  this.flags = {};
  this.initAdapter();
}
848799
private void initNamespaces()
    {
        // The initial prefix mappings will never be deleted because they are at element depth -1
        // (a kludge)

        // Define the default namespace (initially maps to "" uri)
        Stack stack;
        MappingRecord nn;
        nn = new MappingRecord(EMPTYSTRING, EMPTYSTRING, -1);
        stack = createPrefixStack(EMPTYSTRING);
        stack.push(nn);

        // define "xml" namespace
        nn = new MappingRecord(XML_PREFIX, "http://www.w3.org/XML/1998/namespace", -1);
        stack = createPrefixStack(XML_PREFIX);
        stack.push(nn);
    }
1138225
function (namespaces, defaultNamespace, name) {
    var self = this;

    assert(namespaces);
    assert(name);
    if (/^\{.+\}/.test(name)) {
      return name;
    }
    else if (/:/.test(name)) {
      var parts = name.split(':');
      assert(parts.length === 2, parts);
      if (!namespaces[parts[0]]) {
        throw new xml2js.ValidationError("Unknown namespace " + parts[0] + ", name: " + name + ", known namespaces: " + util.inspect(namespaces, false, null));
      }
      return '{' + namespaces[parts[0]] + '}' + parts[1];
    }
    else if (defaultNamespace) {
      return '{' + defaultNamespace + '}' + name;
    }
    else {
      throw new xml2js.ValidationError("Unqualified name and no default namespace: " + name);
    }
  }
467874
public T namespace(String prefix, String namespaceUri) {
        getXpathVariableExtractor().getNamespaces().put(prefix, namespaceUri);
        xmlMessageValidationContext.getNamespaces().put(prefix, namespaceUri);
        return self;
    }
1292540
public static void setNamespace(Element element, String namespace,
            String schemaLocation) {
        element.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI,
                XMLConstants.XMLNS_ATTRIBUTE, namespace);
        element.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, XMLNS_XSI,
                XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
        element.setAttributeNS(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI,
                XSI_SCHEMA_LOCATION, schemaLocation);
    }