xmlDumpElementContent(xmlBufferPtr buf, xmlElementContentPtr content) {
    xmlElementContentPtr cur;

    if (content == NULL) return;

    xmlBufferWriteChar(buf, "(");
    cur = content;

    do {
        if (cur == NULL) return;

        switch (cur->type) {
            case XML_ELEMENT_CONTENT_PCDATA:
                xmlBufferWriteChar(buf, "#PCDATA");
                break;
            case XML_ELEMENT_CONTENT_ELEMENT:
                if (cur->prefix != NULL) {
                    xmlBufferWriteCHAR(buf, cur->prefix);
                    xmlBufferWriteChar(buf, ":");
                }
                xmlBufferWriteCHAR(buf, cur->name);
                break;
            case XML_ELEMENT_CONTENT_SEQ:
            case XML_ELEMENT_CONTENT_OR:
                if ((cur != content) &&
                    (cur->parent != NULL) &&
                    ((cur->type != cur->parent->type) ||
                     (cur->ocur != XML_ELEMENT_CONTENT_ONCE)))
                    xmlBufferWriteChar(buf, "(");
                cur = cur->c1;
                continue;
            default:
                xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR,
                        "Internal: ELEMENT cur corrupted invalid type\n",
                        NULL);
        }

        while (cur != content) {
            xmlElementContentPtr parent = cur->parent;

            if (parent == NULL) return;

            if (((cur->type == XML_ELEMENT_CONTENT_OR) ||
                 (cur->type == XML_ELEMENT_CONTENT_SEQ)) &&
                ((cur->type != parent->type) ||
                 (cur->ocur != XML_ELEMENT_CONTENT_ONCE)))
                xmlBufferWriteChar(buf, ")");
            xmlDumpElementOccur(buf, cur);

            if (cur == parent->c1) {
                if (parent->type == XML_ELEMENT_CONTENT_SEQ)
                    xmlBufferWriteChar(buf, " , ");
                else if (parent->type == XML_ELEMENT_CONTENT_OR)
                    xmlBufferWriteChar(buf, " | ");

                cur = parent->c2;
                break;
            }

            cur = parent;
        }
    } while (cur != content);

    xmlBufferWriteChar(buf, ")");
    xmlDumpElementOccur(buf, content);
}
xmlDumpElementContent(xmlBufferPtr buf, xmlElementContentPtr content) {
    xmlElementContentPtr cur;

    if (content == NULL) return;

    xmlBufferWriteChar(buf, "(");
    cur = content;

    do {
        if (cur == NULL) return;

        switch (cur->type) {
            case XML_ELEMENT_CONTENT_PCDATA:
                xmlBufferWriteChar(buf, "#PCDATA");
                break;
            case XML_ELEMENT_CONTENT_ELEMENT:
                if (cur->prefix != NULL) {
                    xmlBufferWriteCHAR(buf, cur->prefix);
                    xmlBufferWriteChar(buf, ":");
                }
                xmlBufferWriteCHAR(buf, cur->name);
                break;
            case XML_ELEMENT_CONTENT_SEQ:
            case XML_ELEMENT_CONTENT_OR:
                if ((cur != content) &&
                    (cur->parent != NULL) &&
                    ((cur->type != cur->parent->type) ||
                     (cur->ocur != XML_ELEMENT_CONTENT_ONCE)))
                    xmlBufferWriteChar(buf, "(");
                cur = cur->c1;
                continue;
            default:
                xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR,
                        "Internal: ELEMENT cur corrupted invalid type\n",
                        NULL);
        }

        while (cur != content) {
            xmlElementContentPtr parent = cur->parent;

            if (parent == NULL) return;

            if (((cur->type == XML_ELEMENT_CONTENT_OR) ||
                 (cur->type == XML_ELEMENT_CONTENT_SEQ)) &&
                ((cur->type != parent->type) ||
                 (cur->ocur != XML_ELEMENT_CONTENT_ONCE)))
                xmlBufferWriteChar(buf, ")");
            xmlDumpElementOccur(buf, cur);

            if (cur == parent->c1) {
                if (parent->type == XML_ELEMENT_CONTENT_SEQ)
                    xmlBufferWriteChar(buf, " , ");
                else if (parent->type == XML_ELEMENT_CONTENT_OR)
                    xmlBufferWriteChar(buf, " | ");

                cur = parent->c2;
                break;
            }

            cur = parent;
        }
    } while (cur != content);

    xmlBufferWriteChar(buf, ")");
    xmlDumpElementOccur(buf, content);
}