利用VC++实现对XML结点的更新和追加
实现功能:根据配置文件(XXXX.ini)中的内容对XML中节点进行操作,如果XML中存在与配置文件中相同的节点,则根据配置文件将XML文件中相应节点的值进行更新;如果XML文件中不存在配置文件中出现的节点,则在XML中将新节点及值进行插入操作。
◆XML文档结构如下
//--------------------------------------------------------------------------------------------
- <printer driver-name="OKI C710(PS)">
<color-profile path="ColorProfiles/OkiC710CMY.icc" />
</printer>
- <printer driver-name="OKI C710(PCL)">
<color-profile path="ColorProfiles/OkiC710CMY.icc" />
</printer>
- <printer driver-name="OKI C830(PS)">
<color-profile path="ColorProfiles/OkiC830CMY_new.icc
" />
</printer>
- <printer driver-name="OKI C830(PCL)">
<color-profile path="ColorProfiles/OkiC830CMY.icc" />
</printer>
//--------------------------------------------------------------------------------------------
◆配置文件结构如下
//----------------------------------------------------------------------------------------------
[Driver]
D1=OKI C830(PCL);OkiC830CMY_new;ColorProfiles/OkiC830CMY_new.icc
D2=OKI C810(PCL);OkiC810CMY_new;ColorProfiles/OkiC810CMY_new.icc
//-----------------------------------------------------------------------------------------------
实现步骤:
1, 读取配置文件,并将其中的信息内容用类对像进行保存
2, 对XML档进行更新.
因为整个过程并不复杂,现将代码附上。
类定义
//CCustomMediaInfoクラスの定義
//機能:GridLayouter機種設定ツールのGLPDFInfo.datファイル情報を初期化処理
//期日:2009.10.29
//作成:
//その他:The CustomMedia.ini file is located at ..\CustomMedia\CustomMediaInfo.ini
#define MAX_UPDATE_PRN 256 //The must number of printers to be updated.
//To save the value of every item of a line in GLPDFInfo.dat or okPrnInfo
相关文档:
http://www.trendcaller.com/2009/05/hadoop-should-target-cllvm-not-java.html
Sunday, May 10, 2009
Hadoop should target C++/LLVM, not Java (because of watts)
< type="text/javascript">
digg_url="http://www.trendcaller.com/2009/05/hadoop-should-target-cllvm-not-java.html";
Over the years, ......
//数据绑定
public void DataBind()
{
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath(@"App_data/dbGuest.xml"));
&nbs ......
原贴: http://topic.csdn.net/u/20100414/11/c69748ac-e0b2-490f-bde9-7c5284c3660c.html?seed=1832202493
declare @xml xml=
'<upd:Update xmlns:lar="http://schemas.microsoft.com/msus/2002/12/LogicalApplicabilityRules" xmlns:cmd="http://schemas.microsoft.com/msus/2002/12/UpdateHandlers/Command ......
string file = "c:\\work.xml";
private void btnCearte_Click(object sender, EventArgs e)
{
XmlDocument doc = new XmlDocument();
  ......
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
import org.jdom.output.XMLOutputter;
(1)使用JDOM首先要指定使用什么解析器。如:
SAXBuilder builder=new SAXBuilder(false) ......