VC ÀïÔõÑùÓóÌÐòÉú³É XML Îĵµ£¿ - VC/MFC / HTML/XML
ÎÒÏë°Ñ³ÌÐò£¨CÓïÑԵģ©ÖÐÉú³ÉµÄһЩÊý¾ÝÒÔXMLÎĵµµÄÐÎʽ´æ·ÅÆðÀ´¡£
¸Ð¾õϵͳÀà¿âÀïÓ¦¸ÃÓÐһЩ´´½¨XMLµÄº¯Êý£¬±ÈÈçCreateElement(¡¡) ¡¢CreateNode(¡¡)ÕâÑùµÄһЩº¯Êý£¬µ±È»ÕâЩº¯Êý¶¼ÊÇÎÒ²ÂÏëµÄÀ²£¬²»ÖªµÀʵ¼ÊÊDz»ÊÇÕâÑù¡£
ÎÒ¿´µ½VC++2005ÖÐ ÊÓͼ->¶ÔÏóä¯ÀÀÆ÷ ÀïÃæÓиö System.Xml ²»ÖªµÀÄܲ»ÄÜΪÎÒËùÓã¿ÔõôÓã¿
Ï£Íû´óϺÃǸøÖ¸µãһϣ¬Èç¹ûÕâ¸ö²»ÄÜÓã¬ÎÒÒªÊÇÏëÔÚ³ÌÐòÀïÉú³ÉXML½á¹¹µÄ¶«Î÷Ó¦¸ÃÔõô×öÄØ£¿
XML²Ù×÷µÄÀàCMarkup
ÓÑÇé°ï¶¥£¬ÓÑÇé°ï¶¥
VCµÄXML²Ù×÷ÊÇͨ¹ýCOM½Ó¿ÚʵÏֵģ¡
C/C++ code:
UpdateData();
MSXML2::IXMLDOMDocumentPtr pDoc;
MSXML2::IXMLDOMElementPtr xmlRoot;
// ´´½¨DOMDocument¶ÔÏó
HRESULT hr = pDoc.CreateInstance(__uuidof(MSXML2::DOMDocument40));
if(!SUCCEEDED(hr))
{
MessageBox("ÎÞ·¨´´½¨DOMDocument¶ÔÏó£¬Çë¼ì²éÊÇ·ñ°²×°ÁËMS XML Parser ÔËÐпâ! ");
return;
}
// ¸ù½ÚµãµÄÃû³ÆÎªBook
// ´´½¨ÔªËز¢Ìí¼Óµ½ÎĵµÖÐ
xmlRoot = pDoc->createElement((_bstr_t)"Book");
//ÉèÖÃÊôÐÔ
xmlRoot->setAttribute("id" ,(const char *)m_strId);
pDoc->appendChild(xmlRoot);
MSXML2::IXMLDOMElementPtr pNode;
//Ìí¼Ó¡°author¡±ÔªËØ
pNode = pDoc->createElement((_bstr_t)"Author");
pNode->setAttribute("id","001");
//pNode->Puttext((_bstr_t)(const char *)m_str
Ïà¹ØÎÊ´ð£º
ÎÒÓõÄÊÇÁ¬½Ó³Ø×öµÄ£¬ÅäÁ¬½Ó³ØµÄ·½·¨Ó¦¸ÃûÓÐ´í£¬ÎªÊ²¾ÍÊdzöÏÖÕâÖÖÎÊÌâ
javax.servlet.ServletException: javax.naming.NameNotFoundException: No object bound to name java:comp/env/test
ÇëÎÊ´óÏÀÃÇÕâÊÇÔ ......
<?xml version="1.0" encoding="utf-8" ?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical&q ......
ΪʲôÎҵijÌÐòµ÷ÓÃXMLÅäÖÃÎļþÖеİ¢À²®ÎÄÏÔʾ²»³öÀ´£¿ÆäËûµÄÓïÖÖ¶¼¿ÉÒÔ£¬ÈçÖÐÎÄ£¬Ó¢ÎÄ£¬µÂÎͼ¿É¡£
ÎÒ½«XMLµÄ±àÂë¸ÄΪutf-8ºÍunicodeµÄµ½µÃ½á¹û¶¼Ò»Ñù.
°¢À²®ÎĵÄ×Ö¿âÄãÓÐô£¿
ÓÐ,ÎÒµÄEXEÊÇ·ÅÔÚpc»úÉÏÖ´Ðе ......
ΪʲôHTMLÒÔ¼°Ò»Ð©ÆäËü±êÇ©»áÏÔÊ¾Ò»Ð©ÌØ¶¨±íÏÖÐÎÊ½ÄØ£¿ÈçHTMLÖеĻ»ÐбêÇ©<BR/>ÔڵײãÊÇÔõÑùʵÏÖµÄÄØ£¿ÏÖʵµÄÔÀíÊÇÊ²Ã´ÄØ
È¥W3C¹Ù·½ÍøÕ¾ÉÏ£¬¿´¿´°É£¡ÎÒÏëÒ»¿´Äã¾ÍÃ÷°×ÁË
ÎҲºͱàÒëÔÀíÓйأ¬ä¯ÀÀÆ÷Àï¿É ......
ÈçºÎÓÃATL´°ÌåÓ¦ÓóÌÐòÖÐÓÃSystem.Xml±éÀúÒ»¸öXmlÎļþ
Äã˵µÄÊÇÍйܴúÂ룿
¡£
vc¿ÉÓÃmsxml
http://msdn.microsoft.com/en-us/library/ms767594(VS.85).aspx
MSXML4
//ÒýÈëmsxml4.dll &nbs ......