XML½âÎöÆ÷£¬×Ô¼º¼ÓÁ˵ã×¢ÊÍ¡£Áôµ×
#include <iostream>
#include "1.h"
int main(int argc, char *argv[])
{
try
{
SXmlDOM dom;
//dom.parse("<?xml?><Êéµê><Êé±¾ ÊéÃû="VC++" ¼Û¸ñ="50" ÕÛ¿Û="1"/><Êé±¾ ÊéÃû="VB" ¼Û¸ñ="50" ÕÛ¿Û="0.8"/><Êé±¾ ÊéÃû="C#" ¼Û¸ñ="50" ÕÛ¿Û="0.7">ÓÐÔ´³ÌÐò¹âÅÌ</Êé±¾><¹ÒÀú><Äê·Ý>2006</Äê·Ý><¼Û¸ñ>50</¼Û¸ñ></¹ÒÀú></Êéµê>")
dom.parseFile("test.xml");
//²éѯ
SXmlElement& root = dom.root();
cout << "ÓÐ" << root.count("Êé±¾") << "±¾Êé!"<< endl;
cout << "VBµÄ¼Û¸ñ:" << (int)root.item("Êé±¾", 1)["¼Û¸ñ"] * (float)root.item("Êé±¾", 1)["ÕÛ¿Û"] << endl;
cout << root.at(0).xml();
SXmlElement& gl = root.item("¹ÒÀú");
cout << gl.item("Äê·Ý").text() << endl;
//±éÀú
SXmlNodeList::iterator iter;
for(iter = root.begin(); iter!=root.end(); iter++)
cout << (*iter)->xml();
//¸³Öµ
root.item("Êé±¾", 1)["¼Û¸ñ"] = 60;
root.item("Êé±¾", 1)["ÕÛ¿Û"] = 0.5;
cout << "VBµÄ¼Û¸ñ:" << (int)root.item("Êé±¾", 1)["¼Û¸ñ"] * (float)root.item("Êé±¾", 1)["ÕÛ¿Û"] << e
Ïà¹ØÎĵµ£º
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(@"E:\´ó¶þÏÂ\xml\province.xml");
»áÌáʾ³öÏÖÒÔÏ´íÎó
http://hi.csdn.net/attachment/201005/24/0_1274703276Ld6I.gif
Âé·³¸÷λ°ïæ¿´¿´£¬Ð»Ð»ÁË ......
private void CreateNewXmlNode()
{
String strFileName = string.Empty;
strFileName = this.strCurrentPath + "System.xml";
XmlDocument xmlDoc = new XmlDocument();
try
{
xmlDoc.Load(strFileName);
......
ͨ³£Çé¿öÏÂ,ÔÚJAX-WS2.0ÖÐÊÇÀûÓÃJAXB½«´«ÈëµÄSOAP XMLÏûϢת»»³ÉJAVAµÄobject,È»ºóµ÷ÓöÔÓ¦porttypeµÄJAVAÀàµÄÏàÓ¦µÄ·½·¨,ÔÚÍê³Éµ÷Óúó,ÔÙͨ¹ýJAXB½«·µ»Ø²ÎÊýת³ÉSOAP XML.
JAX-WS»¹ÌṩÁËÁíÒ»ÖÖ·½·¨,ÈÃÎÒÃÇ¿ÉÒÔÖ±½Ó²Ù×÷SOAP XML,ͨ¹ýÈöÔÓ¦porttypeµÄJAVAÀàʵÏÖ Provider<Source>½Ó¿Ú,µ±·þÎñÆ÷¶ËÊÕµ½SOAPÏûÏ¢ºó,»áµ ......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Xml;
using System.IO;
using System.Data;
using System.Dat ......
±¾ÎÄ×ܽáÁËÔÚPythonÖÐÖ÷ÒªµÄ¼¸ÖÖ´¦ÀíXMLµÄ·½·¨£º
Element Tree
SAX
Dom
ʹÓõÚÈý·½Àà¿âÈçAmara 2.x£¬ libxml2dom µÈ
Element Tree
Element TreeÊÇPython 2.5ÒýÈëµÄʹÓüòµ¥£¬¿ì½ÝµÄ´¦Àí·½·¨£¬ Ò²ÊÇPython±ê×¼Àà¿âÍÆ¼öµÄ´¦ÀíXMLµÄ·½·¨¡£
ËüʹÓÃÊ÷ÐνڵãµÄÐÎʽÀ´¶ÁдXML¡£Element TreeÊÇÇáÁ¿¼¶µÄDOM£¬ ËùÒÔÊ ......