日期:2014-05-19  浏览次数:21091 次

如何拿c#输出wml
以前网上看见过一篇文章,找不着了。我用c#控制WML输出,该如何写。Response.write老有错误。
如: <?xml   version= "1.0 "   encoding= "GB2312 "?>
        <!DOCTYPE   wml   PUBLIC   "-//WAPFORUM//DTD   WML   1.1//EN "
        "http://www.wapforum.org/DTD/wml_1.1.xml ">
        <wml>    
        <card   id= "card1 ">
        </card>
        </wml>
和:
        <?xml   version= "1.0 "   encoding= "GB2312 "?>
        <!DOCTYPE   wml   PUBLIC   "-//WAPFORUM//DTD   WML   1.1//EN "
        "http://www.wapforum.org/DTD/wml_1.1.xml ">
        <wml>    
        <card   id= "card2 ">
        </card>
        </wml>
两个wml文件。用C#控制判断
if(...)
{
  输出文件1
}
else
{
    输出文件2
}


------解决方案--------------------
Response.Write( " <?xml version=\ "1.0\ " encoding=\ "GB2312\ "?> ");
Response.Write( " <!DOCTYPE wml PUBLIC \ "-//WAPFORUM//DTD WML 1.1//EN\ " \ "http://www.wapforum.org/DTD/wml_1.1.xml\ "> ");
Response.Write( " <wml> ");
if(1 == 1)
{
Response.Write( " <card id=\ "card1\ "> ");
}
else
{
Response.Write( " <card id=\ "card2\ "> ");
}
Response.Write( " </card> ");
Response.Write( " </wml> ");