Ejemplo n.º 1
0
void XSDParser::ParseTypeDefinition(DTDEntity& ent)
{
    string data = ent.GetData();
    string closing;
    TToken tok;
    CComments comments;
    bool doctag_open = false;
    for ( tok=GetNextToken(); tok != K_ENDOFTAG; tok=GetNextToken()) {
        if (tok == T_EOF) {
            break;
        }
        {
            CComments comm;
            Lexer().FlushCommentsTo(comm);
            if (!comm.Empty()) {
                CNcbiOstrstream buffer;
                comm.PrintDTD(buffer);
                data += CNcbiOstrstreamToString(buffer);
                data += closing;
                closing.erase();
            }
            if (!closing.empty()) {
                if (!comments.Empty()) {
                    CNcbiOstrstream buffer;
                    comments.Print(buffer, "", "\n", "");
                    data += CNcbiOstrstreamToString(buffer);
                    comments = CComments();
                }
                data += closing;
                closing.erase();
                doctag_open = false;
            }
        }
        if (tok == K_DOCUMENTATION) {
            if (!doctag_open) {
                data += "<" + m_Raw;
            }
            m_Comments = &comments;
            ParseDocumentation();
            if (!doctag_open) {
                if (m_Raw == "/>") {
                    data += "/>";
                    closing.erase();
                } else {
                    data += ">";
                    closing = m_Raw;
                    doctag_open = true;
                }
            }
        } else if (tok == K_APPINFO) {
            ParseAppInfo();
        } else {
            data += "<" + m_Raw;
            for ( tok = GetNextToken(); tok == K_ATTPAIR || tok == K_XMLNS; tok = GetNextToken()) {
                data += " " + m_Raw;
            }
            data += m_Raw;
        }
        if (tok == K_CLOSING) {
            ent.SetData(data);
            ParseTypeDefinition(ent);
            data = ent.GetData();
        }
    }
    if (!comments.Empty()) {
        CNcbiOstrstream buffer;
        comments.Print(buffer, "", "\n", "");
        data += CNcbiOstrstreamToString(buffer);
        data += closing;
    }
    data += '\n';
    data += m_Raw;
    ent.SetData(data);
}
Ejemplo n.º 2
0
 void AddMember(const AutoPtr<CTypeStrings>& type, int tag, bool nonEmpty, bool noPrefix)
     {
         AddMember(NcbiEmptyString, type, NcbiEmptyString,
                   false, NcbiEmptyString, false, tag,
                   noPrefix,false,false,false,0,nonEmpty,CComments());
     }