code: static public Namespace gatherNamespaces(Document doc) {
     	NamespaceGatherer gatherer=new NamespaceGatherer();	
     	u.forAllStatementOrBundle(doc.getStatementOrBundle(), 
     	                          gatherer);
     	
     	Namespace ns=gatherer.getNamespace();
     	return ns;
      }
docs: /* A Utility to find all namespaces (and associated prefixes). Prefixes are adopted first-come.
  If a prefix is bound to another namespace, then a new prefix is generated for that namespace.