XML解析过程中出现<和>怎么办 VC

ladfkjsoj 2013-05-05 02:07:53

问题如图
其中是使用CMarkup解析的
...全文
1619 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
aaseh 2013-06-07
  • 打赏
  • 举报
回复
替换,亲。 .
贪玩的老鼠 2013-05-06
  • 打赏
  • 举报
回复
CString CXMLFile::DescodeName(LPCSTR sz) { CString strDescode=sz; strDescode.Replace("_&"," "); strDescode.Replace(""","\""); // strDescode.Replace("&","&"); strDescode.Replace("<","<"); strDescode.Replace(">",">"); return strDescode; }
  • 打赏
  • 举报
回复
你有CMarkup的源代码吗?如果有的话,直接在里面添加下<相应的解析,那块代码前些日子我刚改过。
void CMarkup::_ParseMetaChar(LPTSTR& pstrText, LPTSTR& pstrDest)
{
    if( pstrText[0] == _T('a') && pstrText[1] == _T('m') && pstrText[2] == _T('p') && pstrText[3] == _T(';') ) {
        *pstrDest++ = _T('&');
        pstrText += 4;
    }
    else if( pstrText[0] == _T('l') && pstrText[1] == _T('t') && pstrText[2] == _T(';') ) {
        *pstrDest++ = _T('<');
        pstrText += 3;
    }
    else if( pstrText[0] == _T('g') && pstrText[1] == _T('t') && pstrText[2] == _T(';') ) {
        *pstrDest++ = _T('>');
        pstrText += 3;
    }
    else if( pstrText[0] == _T('q') && pstrText[1] == _T('u') && pstrText[2] == _T('o') && pstrText[3] == _T('t') && pstrText[4] == _T(';') ) {
        *pstrDest++ = _T('\"');
        pstrText += 5;
    }
    else if( pstrText[0] == _T('a') && pstrText[1] == _T('p') && pstrText[2] == _T('o') && pstrText[3] == _T('s') && pstrText[4] == _T(';') ) {
        *pstrDest++ = _T('\'');
        pstrText += 5;
    }
    else {
        *pstrDest++ = _T('&');
    }
}

3,056

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC HTML/XML
社区管理员
  • HTML/XML社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧