¶ÁдXMLÎļþ
ÔÎÄ:ʹÓà MSXML ·ÖÎöÆ÷´¦Àí XML Îĵµ
#include <atlbase.h>
#include <iostream>
using namespace std;
//<?xml version="1.0"?>
//<xmldata>
//<xmlnode />
//<xmltext>Hello, World!</xmltext>
//</xmldata>
void main()
{
//³õʼ»¯COMÔËÐпâ
CComPtr<IXMLDOMDocument> spXMLDOM;
HRESULT hr = CoInitialize(NULL);
hr=spXMLDOM.CoCreateInstance(__uuidof(DOMDocument));
if (FAILED(hr))
throw "Unable to create XML parser object!";
if(spXMLDOM.p==NULL)
throw "Unable to create XML parser object!";
//½«XMLÎĵµ¼ÓÔØµ½·ÖÎöÆ÷
VARIANT_BOOL bSuccess=false;
hr=spXMLDOM->load(CComVariant(L"1.xml"),&bSuccess);
if(FAILED(hr))
throw "Unable to load XML document into the parser!";
if (!bSuccess)
throw "Unable to load XML document into the parser!";
//²éÕÒ½Úµã
CComBSTR bstrSS(L"xmldata/xmlnode");
CComPtr<IXMLDOMNode> spXMLNode;
hr=spXMLDOM->selectSingleNode(bstrSS,&spXMLNode);
if (FAILED(hr))
throw "Unable to locate 'xmlnode' XML node!";
if (spXMLNode.p == NULL)
throw "Unable to locate 'xmlnode' XML node!";
//ÔڸýڵãÏ´´½¨×Ó½Úµã
CComPtr<IXMLDOMNode> spXMLChildNode;
hr=spXMLDOM->createNode(CComVariant(NODE_ELEMENT),CComBSTR("xmlchildnode"),NULL,&spXMLChildNode);
if(FAILED(hr))
&
Ïà¹ØÎĵµ£º
XStreamʹÓÃ
XStreamÊÇÒ»¸öJava¶ÔÏóºÍXMLÏ໥ת»»µÄ¹¤¾ß£¬ºÜºÃºÜÇ¿´ó¡£ÌṩÁËËùÓеĻù´¡ÀàÐÍ¡¢Êý×é¡¢¼¯ºÏµÈÀàÐÍÖ±½Óת»»µÄÖ§³Ö¡£Òò´ËXML³£ÓÃÓÚÊý¾Ý½»»»¡¢¶ÔÏóÐòÁл¯£¨ÕâÖÖÐòÁл¯ºÍJava¶ÔÏóµÄÐòÁл¯¼¼ÊõÓÐ×ű¾ÖʵÄÇø±ð£©¡£
XStreamÖеĺËÐÄÀà¾ÍÊÇXStreamÀ࣬һ°ãÀ´Ëµ£¬ÊìϤÕâ¸öÀà»ù±¾¾Í¹»ÓÃÁË£¬Èç¹ûÄãÓõĸü¶à£¬¹À¼ÆÊÇÄ ......
XML How to Program
Beginning Xml Databases
Beginning XSLT and XPath Transforming XML Documents and Data
ASP.NET 2.0 XML
XML ÊÖ²á 4th Edition
XML Schema Complete Reference
......
function getkeyvalue(s_keyname,s_keystr)
s_keybegin="<"+s_keyname+">"
s_keyend="</"+s_keyname+">"
s_i_begin=instr(s_keystr,s_keybegin)
s_i_end=instr(s_keystr,s_keyend)
if s_i_end<=s_i_begin+len(s_keybegin) then
getkeyvalue=""
exit function
else
getkeyvalue=mid(s_k ......
Introduction to XML and XML With Java
If you are looking for sample programs to parse a XML file using DOM/SAX parser or looking for a program to generate a XML file please proceed directly to programs.
This small tutorial introduces you to the basic concepts of XML and using Xer ......
ÕâÆªÎÄÕ±»×ªÔصĴÎÊý×î¶à£¬Æäʵ´úÂë¼òªµÃÎÒ×Ô¼º¶¼¿´²»ÏÂÈ¥¡£Ö»²»¹ý·¢±íÕâÆªÎÄÕÂʱºÜ¶àÈËÐèÒªÕâ¸ö¹¦ÄÜ¡£
Õ⼸Ììд¸öÊý¾Ý¿â²éѯ·ÖÎöÆ÷£¬ÒªÓõ½XML¼Ç¼Óû§×¢²áµÄÊý¾Ý¿âÁ¬½ÓµØÖ·¡¢¶Ë¿ÚµÈÐÅÏ¢£¬×ʼÏëÓÃjava ......