List<Block> () { ASTNode child = myNode.getFirstChildNode(); final Wrap attrWrap = Wrap.createWrap(getWrapType(myXmlFormattingPolicy.getAttributesWrap()), false); final Wrap textWrap = Wrap.createWrap(getWrapType(myXmlFormattingPolicy.getTextWrap(getTag())), true); final Wrap tagBeginWrap = createTagBeginWrapping(getTag()); final Alignment attrAlignment = Alignment.createAlignment(); final Alignment textAlignment = Alignment.createAlignment(); final ArrayList<Block> result = new ArrayList<>(3); ArrayList<Block> localResult = new ArrayList<>(1); boolean insideTag = true; while (child != null) { if (!containsWhiteSpacesOnly(child) && child.getTextLength() > 0) { Wrap wrap = chooseWrap(child, tagBeginWrap, attrWrap, textWrap); Alignment alignment = chooseAlignment(child, attrAlignment, textAlignment); if (child.getElementType() == XmlTokenType.XML_TAG_END) { child = processChild(localResult, child, wrap, alignment, myXmlFormattingPolicy.getTagEndIndent()); result.add(createTagDescriptionNode(localResult)); localResult = new ArrayList<>(1); insideTag = true; } else if (child.getElementType() == XmlTokenType.XML_START_TAG_START) { insideTag = false; if (!localResult.isEmpty()) { result.add(createTagContentNode(localResult)); } localResult = new ArrayList<>(1); child = processChild(localResult, child, wrap, alignment, null); } else if (child.getElementType() == XmlTokenType.XML_END_TAG_START) { insideTag = false; if (!localResult.isEmpty()) { result.add(createTagContentNode(localResult)); localResult = new ArrayList<>(1); } child = processChild(localResult, child, wrap, alignment, null); } else if (child.getElementType() == XmlTokenType.XML_EMPTY_ELEMENT_END) { child = processChild(localResult, child, wrap, alignment, myXmlFormattingPolicy.getTagEndIndent()); result.add(createTagDescriptionNode(localResult)); localResult = new ArrayList<>(1); } else if (isTagListStart(child.getElementType())) { child = processChild(localResult, child, wrap, alignment, null); result.add(createTagDescriptionNode(localResult)); localResult = new ArrayList<>(1); insideTag = true; } else if (isTagListEnd(child.getElementType())) { insideTag = false; if (!localResult.isEmpty()) { result.add(createTagContentNode(localResult)); localResult = new ArrayList<>(1); } child = processChild(localResult, child, wrap, alignment, myXmlFormattingPolicy.getTagEndIndent()); result.add(createTagDescriptionNode(localResult)); localResult = new ArrayList<>(1); } else if (isJspxJavaContainingNode(child)) { createJspTextNode(localResult, child, getChildIndent()); } /* else if (child.getElementType() == ElementType.XML_TEXT) { child = createXmlTextBlocks(localResult, child, wrap, alignment); } */ else { final Indent indent; if (isJspResult(localResult)) { //indent = FormatterEx.getInstance().getNoneIndent(); indent = getChildrenIndent(); } else if (!insideTag) { indent = null; } else { indent = getChildrenIndent(); } child = processChild(localResult, child, wrap, alignment, indent); } } if (child != null) { child = child.getTreeNext(); } } if (!localResult.isEmpty()) { result.add(createTagContentNode(localResult)); } return result; }