Search in sources :

Example 1 with DTDRepeatableContent

use of org.eclipse.wst.dtd.core.internal.emf.DTDRepeatableContent in project webtools.sourceediting by eclipse.

the class DTDPrinter method visitDTDElementContent.

public void visitDTDElementContent(DTDElementContent content) {
    updateStartOffset(content, sb.length());
    // $NON-NLS-1$
    String trailingChars = "";
    if (content instanceof DTDRepeatableContent) {
        DTDRepeatableContent repeatContent = (DTDRepeatableContent) content;
        DTDOccurrenceType occurrenceType = repeatContent.getOccurrence();
        // Integer occurrence = repeatContent.getOccurrence();
        if (occurrenceType != null) {
            int occurType = occurrenceType.getValue();
            if (occurType != DTDOccurrenceType.ONE) {
                if (repeatContent instanceof DTDEntityReferenceContent) {
                    // $NON-NLS-1$
                    sb.append("(");
                    // $NON-NLS-1$
                    trailingChars = ")";
                }
                trailingChars += (char) occurType;
            }
        }
    // end of if ()
    }
    if (content instanceof DTDGroupContent) {
        super.visitDTDElementContent(content);
    } else // end of if ()
    if (content instanceof DTDElementReferenceContent || content instanceof DTDEntityReferenceContent) {
        sb.append(((DTDRepeatableContent) content).unparseRepeatableContent());
    } else // end of if ()
    {
        // handle DTDPCDataContent, DTDAnyContent and DTDEmptyContent here
        sb.append(content.getContentName());
    }
    // end of else
    sb.append(trailingChars);
    updateEndOffset(content, sb.length());
}
Also used : DTDGroupContent(org.eclipse.wst.dtd.core.internal.emf.DTDGroupContent) DTDEntityReferenceContent(org.eclipse.wst.dtd.core.internal.emf.DTDEntityReferenceContent) DTDElementReferenceContent(org.eclipse.wst.dtd.core.internal.emf.DTDElementReferenceContent) DTDRepeatableContent(org.eclipse.wst.dtd.core.internal.emf.DTDRepeatableContent) DTDOccurrenceType(org.eclipse.wst.dtd.core.internal.emf.DTDOccurrenceType)

Aggregations

DTDElementReferenceContent (org.eclipse.wst.dtd.core.internal.emf.DTDElementReferenceContent)1 DTDEntityReferenceContent (org.eclipse.wst.dtd.core.internal.emf.DTDEntityReferenceContent)1 DTDGroupContent (org.eclipse.wst.dtd.core.internal.emf.DTDGroupContent)1 DTDOccurrenceType (org.eclipse.wst.dtd.core.internal.emf.DTDOccurrenceType)1 DTDRepeatableContent (org.eclipse.wst.dtd.core.internal.emf.DTDRepeatableContent)1