private Block createBlockFor(final Pair<? extends PsiElement, ? extends Language> root) {
    final FormattingModelBuilder builder = LanguageFormatting.INSTANCE.forContext(root.getSecond(), root.getFirst());
    if (builder != null) {
      final Block result = builder.createModel(FormattingContext.create(root.getFirst(), getSettings())).getRootBlock();
      if (result instanceof XmlBlock) {
        final XmlFormattingPolicy policy = getPolicy((XmlBlock)result);
        policy.setRootModels(myRootToBlockMap);
        policy.doNotProcessJsp();
      }
      return result;
    }
    else {
      return null;
    }
  }
private Block createBlockFor(final Pair<? extends PsiElement, ? extends Language> root)