org_eclipse_lemminx_extensions_generators_xml2dtd_XML2DTDGeneratorTest_java
org.eclipse.lemminx.extensions.generators.xml2dtd.XML2DTDGenerator
@Override
    protected void generate(Grammar grammar, DTDGeneratorSettings settings, XMLBuilder dtd) {
        for (ElementDeclaration elementDecl : grammar.getElements()) {
            boolean hasCharacterContent = elementDecl.hasCharacterContent();
            dtd.startDTDElementDecl();
            dtd.addParameter(elementDecl.getName());
            Collection<ElementDeclaration> children = elementDecl.getElements();
            if (children.isEmpty()) {
                if (hasCharacterContent) {
                    dtd.addContent(" (#PCDATA)");
                } else {
                    dtd.addContent(" EMPTY");
                }
            } else if (!hasCharacterContent) {
                boolean first;
                boolean sequenced = elementDecl.getChildrenProperties().isSequenced();
                if (sequenced) {
                    dtd.addContent(" (");
                    first = true;
                    for (Map.Entry entry : elementDecl.getChildrenProperties().getCardinalities().entrySet()) {
                        if (!first) {
                            dtd.addContent(",");
                        }
                        first = false;
                        dtd.addContent((String)entry.getKey());
                        Cardinality cardinality = (Cardinality)entry.getValue();
                        if (cardinality.getMin() == 0L && cardinality.getMax() == 1L) {
                            dtd.addContent("?");
                            continue;
                        }
                        if (cardinality.getMin() == 0L && cardinality.getMax() > 1L) {
                            dtd.addContent("*");
                            continue;
                        }
                        if (cardinality.getMax() <= 1L) continue;
                        dtd.addContent("+");
                    }
                    dtd.addContent(")");
                } else {
                    dtd.addContent(" (");
                    first = true;
                    for (ElementDeclaration elementDeclaration : children) {
                        if (!first) {
                            dtd.addContent("|");
                        }
                        first = false;
                        dtd.addContent(elementDeclaration.getName());
                    }
                    dtd.addContent(")*");
                }
            } else {
                dtd.addContent("(#PCDATA");
                if (hasCharacterContent) {
                    for (ElementDeclaration elementInfo : children) {
                        dtd.addContent("|");
                        dtd.addContent(elementInfo.getName());
                    }
                }
                dtd.addContent(")*");
            }
            dtd.closeStartElement();
            Collection<AttributeDeclaration> attributes = elementDecl.getAttributes();
            if (attributes.isEmpty()) continue;
            for (AttributeDeclaration attribute : attributes) {
                dtd.startDTDAttlistDecl();
                dtd.addParameter(elementDecl.getName());
                boolean bl = attribute.isRequired();
                boolean isID = attribute.isID(settings);
                boolean fixed = attribute.isFixedValue(settings);
                boolean enums = attribute.isEnums(settings);
                String tokentype = attribute.isAllNMTOKENs() ? "NMTOKEN" : "CDATA";
                dtd.addParameter(attribute.getName());
                if (isID) {
                    dtd.addParameter("ID");
                } else if (fixed) {
                    String val = attribute.getValues().first();
                    dtd.addParameter(tokentype);
                    dtd.addParameter("#FIXED");
                    dtd.addParameter("\"" + val + "\"");
                } else if (enums) {
                    dtd.addContent(" (");
                    SortedSet<String> values = attribute.getValues();
                    boolean first = true;
                    for (String value : values) {
                        if (!first) {
                            dtd.addContent("|");
                        }
                        dtd.addContent(value);
                        first = false;
                    }
                    dtd.addContent(")");
                } else {
                    dtd.addParameter(tokentype);
                }
                if (!fixed) {
                    if (bl) {
                        dtd.addParameter("#REQUIRED");
                    } else {
                        dtd.addParameter("#IMPLIED");
                    }
                }
                dtd.closeStartElement();
            }
        }
    }
 -> java.util.Map.values(): java.util.Collection -> java.util.Collection.iterator(): java.util.Iterator -> java.util.Iterator.hasNext(): boolean -> java.util.Iterator.next(): java.lang.Object -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.toString(): java.lang.String -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.util.Map.values(): java.util.Collection -> java.util.Collection.isEmpty(): boolean -> java.lang.Boolean.booleanValue(): boolean -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.util.Map.entrySet(): java.util.Set -> java.util.Set.iterator(): java.util.Iterator -> java.util.Iterator.hasNext(): boolean -> java.util.Iterator.next(): java.lang.Object -> java.util.Map$Entry.getKey(): java.lang.Object -> java.lang.Boolean.booleanValue(): boolean -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.util.Map$Entry.getValue(): java.lang.Object -> java.lang.Boolean.booleanValue(): boolean -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.util.Iterator.hasNext(): boolean -> java.lang.Boolean.booleanValue(): boolean -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.util.Map.values(): java.util.Collection -> java.util.Collection.isEmpty(): boolean -> java.util.Iterator.hasNext(): boolean -> java.util.Iterator.next(): java.lang.Object -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.toString(): java.lang.String -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.util.Map.values(): java.util.Collection -> java.util.Collection.isEmpty(): boolean -> java.lang.Boolean.booleanValue(): boolean -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.util.Map.values(): java.util.Collection -> java.util.Collection.isEmpty(): boolean -> java.util.Collection.iterator(): java.util.Iterator -> java.util.Iterator.hasNext(): boolean -> java.util.Iterator.next(): java.lang.Object -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.toString(): java.lang.String -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.util.SortedSet.size(): int -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.toString(): java.lang.String -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.toString(): java.lang.String -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.toString(): java.lang.String -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.util.Iterator.hasNext(): boolean -> java.util.Iterator.next(): java.lang.Object -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.toString(): java.lang.String -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.toString(): java.lang.String -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.toString(): java.lang.String -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.toString(): java.lang.String -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.util.Iterator.hasNext(): boolean -> java.util.Iterator.hasNext(): boolean
 [CALL] [CALL] [CALL] -> java.util.Map.values(): java.util.Collection [EXIT] -> java.util.Collection.iterator(): java.util.Iterator -> java.util.Iterator.hasNext(): boolean -> java.util.Iterator.next(): java.lang.Object [CALL] [EXIT] [CALL] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [EXIT] [EXIT] [CALL] [EXIT] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [CALL] [CALL] [CALL] [EXIT] [CALL] [CALL] [EXIT] [EXIT] [EXIT] [EXIT] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.toString(): java.lang.String [CALL] [CALL] [CALL] [CALL] [EXIT] [CALL] [CALL] [EXIT] [EXIT] [EXIT] [EXIT] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [EXIT] [EXIT] [EXIT] [CALL] -> java.util.Map.values(): java.util.Collection [EXIT] -> java.util.Collection.isEmpty(): boolean [CALL] [EXIT] [CALL] [EXIT] [CALL] [CALL] [CALL] [CALL] [EXIT] [CALL] [CALL] [CALL] [CALL] [EXIT] [CALL] [EXIT] [EXIT] [EXIT] -> java.lang.Boolean.booleanValue(): boolean [EXIT] [EXIT] [CALL] [CALL] [EXIT] [CALL] [CALL] [EXIT] [EXIT] [EXIT] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [EXIT] [EXIT] [EXIT] [CALL] [EXIT] [CALL] [EXIT] -> java.util.Map.entrySet(): java.util.Set -> java.util.Set.iterator(): java.util.Iterator -> java.util.Iterator.hasNext(): boolean -> java.util.Iterator.next(): java.lang.Object -> java.util.Map$Entry.getKey(): java.lang.Object [CALL] [CALL] [CALL] [CALL] [EXIT] [CALL] [CALL] [CALL] [CALL] [EXIT] [CALL] [EXIT] [EXIT] [EXIT] -> java.lang.Boolean.booleanValue(): boolean [EXIT] [EXIT] [CALL] [CALL] [EXIT] [CALL] [CALL] [EXIT] [EXIT] [EXIT] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [EXIT] [EXIT] [EXIT] -> java.util.Map$Entry.getValue(): java.lang.Object [CALL] [EXIT] [CALL] [EXIT] [CALL] [EXIT] [CALL] [CALL] [CALL] [CALL] [EXIT] [CALL] [CALL] [CALL] [CALL] [EXIT] [CALL] [EXIT] [EXIT] [EXIT] -> java.lang.Boolean.booleanValue(): boolean [EXIT] [EXIT] [CALL] [CALL] [EXIT] [CALL] [CALL] [EXIT] [EXIT] [EXIT] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [EXIT] [EXIT] [EXIT] -> java.util.Iterator.hasNext(): boolean [CALL] [CALL] [CALL] [CALL] [EXIT] [CALL] [CALL] [CALL] [CALL] [EXIT] [CALL] [EXIT] [EXIT] [EXIT] -> java.lang.Boolean.booleanValue(): boolean [EXIT] [EXIT] [CALL] [CALL] [EXIT] [CALL] [CALL] [EXIT] [EXIT] [EXIT] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [EXIT] [EXIT] [EXIT] [CALL] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [EXIT] [EXIT] [CALL] -> java.util.Map.values(): java.util.Collection [EXIT] -> java.util.Collection.isEmpty(): boolean -> java.util.Iterator.hasNext(): boolean -> java.util.Iterator.next(): java.lang.Object [CALL] [EXIT] [CALL] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [EXIT] [EXIT] [CALL] [EXIT] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [CALL] [CALL] [CALL] [EXIT] [CALL] [CALL] [EXIT] [EXIT] [EXIT] [EXIT] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.toString(): java.lang.String [CALL] [CALL] [CALL] [CALL] [EXIT] [CALL] [CALL] [EXIT] [EXIT] [EXIT] [EXIT] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [EXIT] [EXIT] [EXIT] [CALL] -> java.util.Map.values(): java.util.Collection [EXIT] -> java.util.Collection.isEmpty(): boolean [CALL] [CALL] [CALL] [CALL] [EXIT] [CALL] [CALL] [CALL] [CALL] [EXIT] [CALL] [EXIT] [EXIT] [EXIT] -> java.lang.Boolean.booleanValue(): boolean [EXIT] [EXIT] [CALL] [CALL] [EXIT] [CALL] [CALL] [EXIT] [EXIT] [EXIT] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [EXIT] [EXIT] [EXIT] [CALL] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [EXIT] [EXIT] [CALL] -> java.util.Map.values(): java.util.Collection [EXIT] -> java.util.Collection.isEmpty(): boolean -> java.util.Collection.iterator(): java.util.Iterator -> java.util.Iterator.hasNext(): boolean -> java.util.Iterator.next(): java.lang.Object [CALL] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [EXIT] [EXIT] [CALL] [EXIT] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [CALL] [CALL] [CALL] [EXIT] [CALL] [CALL] [EXIT] [EXIT] [EXIT] [EXIT] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.toString(): java.lang.String [CALL] [CALL] [CALL] [CALL] [EXIT] [CALL] [CALL] [EXIT] [EXIT] [EXIT] [EXIT] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [EXIT] [EXIT] [EXIT] [CALL] [CALL] [EXIT] [CALL] [EXIT] [EXIT] [CALL] [CALL] [EXIT] [CALL] [EXIT] [CALL] [EXIT] [EXIT] [CALL] [CALL] [CALL] [EXIT] [CALL] [EXIT] [EXIT] [CALL] [EXIT] -> java.util.SortedSet.size(): int [CALL] [EXIT] [CALL] [EXIT] [EXIT] [CALL] [CALL] [EXIT] [CALL] [EXIT] [CALL] [EXIT] [EXIT] [CALL] [EXIT] [CALL] [EXIT] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [CALL] [CALL] [CALL] [EXIT] [CALL] [CALL] [EXIT] [EXIT] [EXIT] [EXIT] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.toString(): java.lang.String [CALL] [CALL] [CALL] [CALL] [EXIT] [CALL] [CALL] [EXIT] [EXIT] [EXIT] [EXIT] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [EXIT] [EXIT] [EXIT] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [CALL] [CALL] [CALL] [EXIT] [CALL] [CALL] [EXIT] [EXIT] [EXIT] [EXIT] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.toString(): java.lang.String [CALL] [CALL] [CALL] [CALL] [EXIT] [CALL] [CALL] [EXIT] [EXIT] [EXIT] [EXIT] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [EXIT] [EXIT] [EXIT] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [CALL] [CALL] [CALL] [EXIT] [CALL] [CALL] [EXIT] [EXIT] [EXIT] [EXIT] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.toString(): java.lang.String [CALL] [CALL] [CALL] [CALL] [EXIT] [CALL] [CALL] [EXIT] [EXIT] [EXIT] [EXIT] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [EXIT] [EXIT] [EXIT] [CALL] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [EXIT] [EXIT] -> java.util.Iterator.hasNext(): boolean -> java.util.Iterator.next(): java.lang.Object [CALL] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [EXIT] [EXIT] [CALL] [EXIT] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [CALL] [CALL] [CALL] [EXIT] [CALL] [CALL] [EXIT] [EXIT] [EXIT] [EXIT] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.toString(): java.lang.String [CALL] [CALL] [CALL] [CALL] [EXIT] [CALL] [CALL] [EXIT] [EXIT] [EXIT] [EXIT] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [EXIT] [EXIT] [EXIT] [CALL] [CALL] [EXIT] [CALL] [EXIT] [EXIT] [CALL] [CALL] [EXIT] [CALL] [EXIT] [CALL] [EXIT] [CALL] [EXIT] [CALL] [EXIT] [EXIT] [CALL] [CALL] [CALL] [EXIT] [CALL] [EXIT] [EXIT] [EXIT] [CALL] [CALL] [EXIT] [CALL] [EXIT] [CALL] [EXIT] [EXIT] [CALL] [EXIT] [CALL] [EXIT] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [CALL] [CALL] [CALL] [EXIT] [CALL] [CALL] [EXIT] [EXIT] [EXIT] [EXIT] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.toString(): java.lang.String [CALL] [CALL] [CALL] [CALL] [EXIT] [CALL] [CALL] [EXIT] [EXIT] [EXIT] [EXIT] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [EXIT] [EXIT] [EXIT] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [CALL] [CALL] [CALL] [EXIT] [CALL] [CALL] [EXIT] [EXIT] [EXIT] [EXIT] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.toString(): java.lang.String [CALL] [CALL] [CALL] [CALL] [EXIT] [CALL] [CALL] [EXIT] [EXIT] [EXIT] [EXIT] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [EXIT] [EXIT] [EXIT] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [CALL] [CALL] [CALL] [EXIT] [CALL] [CALL] [EXIT] [EXIT] [EXIT] [EXIT] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder -> java.lang.StringBuilder.toString(): java.lang.String [CALL] [CALL] [CALL] [CALL] [EXIT] [CALL] [CALL] [EXIT] [EXIT] [EXIT] [EXIT] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [EXIT] [EXIT] [EXIT] [CALL] [CALL] -> java.lang.StringBuilder.append(java.lang.String): java.lang.StringBuilder [EXIT] [EXIT] -> java.util.Iterator.hasNext(): boolean -> java.util.Iterator.hasNext(): boolean [EXIT] [EXIT]