¹ØÓÚHTTP·ÃÎÊXMLÎļþµÄËæ±Ê
×î½üÏîÄ¿ÖÐÒªÓõ½Ò»Ð©web xmlÊý¾ÝµÄ·ÃÎÊ·ÖÎö£¬²ÉÓÃmsxml
1.msxmlÊÇ΢ÈíÌṩµÄ£¬ÔÚ·Ç¿ª·¢»·¾³ÖУ¬ÐèҪע²á
2.xmlÎļþ£¬Ò»°ãÔÚµÚÒ»¾äÓбàÂ뷽ʽ£¬Ò»°ãĬÈÏÊÇutf-8£¬ÊôÓÚÒ»ÖÖunicode
3.´ÓÍøÂç²É¼¯µÄxmlÊý¾Ý£¬ÐèҪʹÓÃwinnetº¯Êý¿â
4.winnet²É¼¯×ÔÍøÂçµÄÊý¾Ý£¬Ä¬ÈϵͼÊÇCP_ACP¸ñʽµÄ£¬¼òµ¥Ëµ¾ÍÊÇANSI»òUNICODE£¬UTF8µÄ±àÂ뷽ʽÊÇCP_UTF8£¬Õâô¿´xmlÊý¾Ý£¬×Ö·ûÊÇÕý³£µÄ£¬µ«ÊǺº×Ö¶¼ÊÇÂÒÂë
5.½â¾öutf-8ÂÒÂë·½·¨£º
UNICODE -> ANSI : CT2A or MultiByteToWideChar
ANSI -> UTF8: WideCharToMultiByte
wstring AStringToWString(const string& szSrc, UINT nCodePage)
{
wstring lstrResult;
if (!szSrc.empty())
{
int length = MultiByteToWideChar(nCodePage, 0, szSrc.c_str(), -1, NULL, 0);
wchar_t* lpwszTemp = new wchar_t[length + 1];
memset(lpwszTemp, 0, (length + 1) * sizeof(wchar_t));
MultiByteToWideChar(nCodePage, 0, szSrc.c_str(), -1, lpwszTemp, length);
lstrResult = lpwszTemp;
delete[] lpwszTemp;
}
return lstrResult;
}
string WStringToAString(const wstring& szSrc, UINT nCodePage)
{
string lstrResult;
if (!szSrc.empty())
{
int length = WideCharToMultiByte(nCodePage, 0, szSrc.c_str(), -1, NULL, 0, NULL, NULL);
char* lpszTemp = new char[length + 1];
memset(lpszTemp, 0, length + 1);
&nbs
Ïà¹ØÎĵµ£º
Step 1£ºForm1 ÉÏÌí¼ÓÒ»¸öToolStripContainer¿Ø¼þ
Step2£ºÊµÏÖ´úÂë
private void Form2_Load(object sender, EventArgs e)
{
CMenuEx menu = new CMenuEx();
string sPath = "D:\\Menu.xml";//xmlµÄÄÚÈÝ
if (menu.FileExit())
&nb ......
±¾ÎĽéÉÜÁ˸÷ÖÖ½âÎö·½·¨£¬×ÅÖØ·ÖÎöÁ˸÷×ÔµÄÓÅȱµã:
½âÎöµÄÖØÒªÐÔ
¡¡¡¡½âÎöÎªÊ²Ã´ÖØÒª?ÒòΪËùÓÐ XML ´¦Àí¶¼´Ó½âÎö¿ªÊ¼¡£ÎÞÂÛʹÓø߲ã±à³ÌÓïÑÔ(Èç XSLT)»¹ÊǵͲã Java ±à³Ì£¬µÚÒ»²½¶¼ÊÇÒª¶ÁÈë XML Îļþ£¬½âÂë½á¹¹ºÍ¼ìË÷ÐÅÏ¢µÈµÈ£¬Õâ¾ÍÊǽâÎö¡£
¡¡¡¡½âÎöÎĵµÊ±ÃæÁٵĵÚÒ»¸öÑ¡ÔñÊDzÉÓÃÏֳɵĽâÎö¿â(»ù±¾ÉÏÿÖÖ±à³ÌÓïÑÔ¶¼Ó ......
xml£º
<?xml version="1.0" encoding="utf-8" ?>
<library>
<name>Ê×¶¼Í¼Êé¹Ý</name>
<address>³¯ÑôÇø»ªÍþÇÅÄÏ</address>
<books>
<book type="math">
<id>0000</id>
</book&g ......
1¡£Ð´Ò»¸öxmlÎļþ
<?xml version="1.0" encoding="utf-8" ?>
- <root>
- <user id="101">
<name>abc</name>
<password>abc</password>
</user>
- <user id="102">
<name>ccc</name>
<password>ccc< ......