code: public List<NamespaceDefinition> sortByDependencies() throws XmlException {
  
          ArrayList<NamespaceDefinition> sorted = new ArrayList<NamespaceDefinition>();
  
          Map<Namespace, List<String>> namespaceMap = createNamespaceMap(jaxb.getNamespaceDefinitions());
  
          NamespaceDefinition def = null;
          do {
              def = extractNamespaceWithLeastDependencies(namespaceMap);
              if(def != null) {
                  sorted.add(def);
              }
          } while(def != null);
  
          return(sorted);
      }
docs: A NamespaceDefinition cannot be injected into the DB unless it's dependencies are injected first.
  This method will sort the given list of NamespaceDefinitions by dependency.
  
  If dependencies are missing, or circular dependencies exist such that there aren't any NamespaceDefinitions without dependencies
  a XmlException will be thrown.
  
  @return The list of NamespaceDefinition Object, sorted by dependencies
  
  @throws XmlException if dependencies are missing or circular dependencies exist such that there aren't any NamespaceDefinitions without dependencies