code: private Map<String, Scope> parseScopes(NodeList scopeNodeList) {
          Map<String, Scope> scopes = new HashMap<String, Scope>();
  
          // Parse scopes
          for (int i = 0; i < scopeNodeList.getLength(); i++) {
              Element scopeElement = (Element) scopeNodeList.item(i);
              String name = scopeElement.getAttribute(TAG_SCOPE_ATTR_NAME);
              if (name.length() == 0) {
                  throw new TextProcessorFactoryException("Illegal scope name. Scope name can't be empty.");
              }
              Scope scope =
                      new Scope(
                              name,
                              nodeAttribute(scopeElement, TAG_SCOPE_ATTR_IGNORE_TEXT, Scope.DEFAULT_IGNORE_TEXT)
                      );
              scope.setStrong(nodeAttribute(scopeElement, TAG_SCOPE_ATTR_STRONG, Scope.DEFAULT_STRONG));
              scopes.put(scope.getName(), scope);
          }
  
          // Set parents
          for (int i = 0; i < scopeNodeList.getLength(); i++) {
              Element scopeElement = (Element) scopeNodeList.item(i);
  
              String name = scopeElement.getAttribute(TAG_SCOPE_ATTR_NAME);
              Scope scope = scopes.get(name);
              if (scope == null) {
                  throw new TextProcessorFactoryException(
                          MessageFormat.format("Can't find scope \"{0}\".", name)
                  );
              }
  
              String parentName = nodeAttribute(scopeElement, TAG_SCOPE_ATTR_PARENT);
              if (parentName != null) {
                  Scope parent = scopes.get(parentName);
                  if (parent == null) {
                      throw new TextProcessorFactoryException(
                              MessageFormat.format("Can't find parent scope \"{0}\".", parentName)
                      );
                  }
                  scope.setParent(parent);
              }
              scope.setMax(nodeAttribute(scopeElement, TAG_SCOPE_ATTR_MAX, Scope.DEFAULT_MAX_VALUE));
              scope.setMin(nodeAttribute(scopeElement, TAG_SCOPE_ATTR_MIN, Scope.DEFAULT_MIN_VALUE));
          }
  
          return scopes;
      }
docs: Parse scopes from XML
  
  @param scopeNodeList list with scopes definitions
  @return scopes
  @throws TextProcessorFactoryException any problems