String (String name, List<String> tags, List<? extends MyAttributeInfo> attributes) { if (name == null || name.isEmpty()) return ""; if (name.contains(CompletionUtilCore.DUMMY_IDENTIFIER_TRIMMED)) return ""; final @NonNls StringBuilder buffer = new StringBuilder(); buffer.append("<!ELEMENT ").append(name).append(" "); if (tags.isEmpty()) { buffer.append("(#PCDATA)>\n"); } else { buffer.append("("); final Iterator<String> iter = tags.iterator(); while (iter.hasNext()) { final String tagName = iter.next(); buffer.append(tagName); if (iter.hasNext()) { buffer.append("|"); } else { buffer.append(")*"); } } buffer.append(">\n"); } if (!attributes.isEmpty()) { buffer.append("<!ATTLIST ").append(name); for (final MyAttributeInfo info : attributes) { buffer.append("\n ").append(generateAttributeDTD(info)); } buffer.append(">\n"); } return buffer.toString(); }