code: protected Map<Namespace, List<String>> createNamespaceMap(List<NamespaceDefinition> namespaceDefs) throws XmlException {
          ArrayList<Namespace> namespaces = new ArrayList<Namespace>();
  
          // add all root namespaces
          for(NamespaceDefinition namespaceDef: namespaceDefs) {
              Namespace node = new Namespace(namespaceDef);
              if(namespaces.contains(node)) {
                  throw new XmlException("duplicate NamespaceDefinitions found: " + node.getId());
              }
              namespaces.add(node);
          }
  
          // go through each namespace's dependencies to see if any are missing
          for(Namespace namespace: namespaces) {
              List<String> dependencyIds = namespace.getDirectDependencyIds();
              for(String id: dependencyIds) {
                  if(find(namespaces, id) == null) {
                      throw new XmlException("Found missing dependency: " + id);
                  }
              }
          }
  
          HashMap<Namespace, List<String>> namespaceFullDependencyMap = new HashMap<Namespace, List<String>>();
          for(Namespace namespace: namespaces) {
              ArrayList<String> fullDependencies = new ArrayList<String>();
  
              for(String directDependencyId: namespace.getDirectDependencyIds()) {
                  addDependenciesRecursively(namespace, namespaces, directDependencyId, fullDependencies);
              }
  
              namespaceFullDependencyMap.put(namespace, fullDependencies);
          }
  
          return(namespaceFullDependencyMap);
      }
docs: Checks that there aren't namespaces that depend on namespaces that don't exist in the list,
  and creates a list of all Namespace Objects in the list.
  
  @throws XmlException if there are any dependencies missing.