91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 621KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-06-03
  • 語言: 其他
  • 標簽:

資源簡介

針對 XML文件的讀取操作, CFileReader讀取文件流程 OpenFile 打開PFS中的XML文件 OpenNativeFile 打開原始文件中的XML文件 OpenFile( PFS::CBaseFile& bf); 打開PFS中的文件對象 OpenData 打開一份內(nèi)存數(shù)據(jù) 打開完成后,GetRootNode可以得到根節(jié)點的元素對象CINode CINode 的方法 GetType 得到元素類型 GetChildren 得到所有的子元素 GetAttributeNames 得到所以的屬性列表 GetAttribute 得到某個屬性的值 GetText 得到文件值 GetName 得到元素名字 CFileWriter寫XML文件的流程 CONode GetRootNode(); 得到根節(jié)點元素 操作完成后,調(diào)用 Save( const std::wstring& filename); 保存到PFS SaveNative( const std::wstring& filename); 保存到原始目錄 Save( PFS::CBaseFile& bf); 保存到PFS文件對象 SaveData( GNET::Octets& data); 保存到內(nèi)存 CONode的方法 bool SetAttribute( const std::wstring& name, const std::wstring& value); 設置屬性 CONode CreateSubElement( const std::wstring& name); 創(chuàng)建子元素 bool InsertText( const std::wstring& text); 設置文本 bool InsertCData( const std::wstring& data); 添加CDATA數(shù)據(jù)

資源截圖

代碼片段和文件信息


#include?

#include?
#include?
#include?
#include?
#include?
#include?

#include?“../../pfs/pfs.h“
#include?“../xmlio.h“

#include?
#include?

#pragma?comment(?lib?“winmm.lib“)

void?PrintTab(?int?nTab?const?wchar_t*?info?...)
{
for(?int?i?=?0;?i? printf(?“\t“);

va_list vl;
va_start(?vl?info);
vwprintf(?info?vl);
va_end(?vl);
}

void?DumpNode(?const?xmlIO::CINode&?node?int?nTab?=?0)
{
PrintTab(?nTab?L“?node?name?=?%s\n“?node.GetName().c_str());

xmlIO::CAttributesNames anames;
node.GetAttributeNames(anames);
std::wstring?value;
for(?xmlIO::CAttributesNames::iterator?it?=?anames.begin();?it?!=?anames.end();?++?it)
{
std::wstring&?onename?=?*it;

node.GetAttribute(?onename?value);
PrintTab(?nTab?L“?node?attribute?%s?=?%s\n“?onename.c_str()?value.c_str());
}
std::wstring?thistext?=?node.GetText();
if(?!thistext.empty())
PrintTab(?nTab?L“?node?text?=?%s\n“?thistext.c_str());
thistext?=?node.GetSubText();
if(?!thistext.empty())
PrintTab(?nTab?L“?node?subtext?=?%s\n“?thistext.c_str());

xmlIO::CNodeList?nl;
node.GetChildren(nl);
for(?xmlIO::CNodeList::iterator?it?=?nl.begin();?it?!=?nl.end();?++?it)
DumpNode(?*it?nTab?+?1);
}

int?Checkxml(?const?std::wstring&?filename)
{
xmlIO::CFileReader fr;
int?nError?=?fr.OpenFile(?filename);
if(?xmlIO::EC_SUCCESS?!=?nError)
return?nError;

xmlIO::CINode root;
fr.GetRootNode(root);
DumpNode(?root);

{
PFS::CDataBlock data;
fr.SaveAsOctets(?data);
PFSX::CNativeFile nf;
nf.Open(?L“d:\\temp\\outbin.xml“?PFS::FM_CREAT?|?PFS::FM_TRUNC?PFS::FA_WRONLY);
nf.Write(?data.GetData()?data.GetSize());
}
{
xmlIO::CFileReader fr;
int?nError?=?fr.OpenNativeFile(?L“d:\\temp\\outbin.xml“);
xmlIO::CINode root;
fr.GetRootNode(root);
DumpNode(?root?);
}
fr.CloseFile();
return?xmlIO::EC_SUCCESS;
}

int?CheckNativexml(?const?std::wstring&?filename)
{
xmlIO::CFileReader fr;
int?nError?=?fr.OpenNativeFile(?filename);
if(?xmlIO::EC_SUCCESS?!=?nError)
return?nError;

xmlIO::CINode root;
fr.GetRootNode(root);

DumpNode(?root);

fr.CloseFile();
return?xmlIO::EC_SUCCESS;
}

int?Createxml()
{
xmlIO::CFileWriter fw;

xmlIO::CONode?node;
fw.GetRootNode(node);

xmlIO::CONode?subnode;
fw.CreateElement(?node?L“test“?subnode);
subnode.SetAttribute(?L“test1“?L“ou subnode.SetAttribute(?L“test2“?L“ou>t2“);
subnode.SetAttribute(?L“test3“?L““);

std::wstring strtest?=?L“asf1as;d&f..asf<>?..\\/“;
fw.InsertCData(?subnode?strtest);
fw.InsertText(?subnode?strtest);

xmlIO::CONode?subnode11;
fw.CreateElement(?subnode?L“test11“?subnode11);
subnode11.SetAttribute(?L“test11“?L“a11“);
subnode11.SetAttribute(?L“haha“?L“hehe“);
subnode11.SetAttribute(?L“test3“?L“a33“);
subnode11.InsertText(?L“testtext“);

xmlI

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件??????27570??2016-03-14?09:53??xmlio\msdom.h

?????文件???????7657??2016-03-14?09:53??xmlio\projects\octetsio.vcproj

?????文件???????9205??2019-08-17?22:33??xmlio\projects\octetsio.vcxproj

?????文件???????1090??2019-08-17?22:33??xmlio\projects\octetsio.vcxproj.filters

?????文件???????5454??2016-03-14?09:53??xmlio\projects\xmlio.sln

?????文件???????7008??2016-03-14?09:53??xmlio\projects\xmlio.vcproj

?????文件???????9159??2016-03-14?09:53??xmlio\projects\xmlio.vcxproj

?????文件????????510??2016-03-14?09:53??xmlio\projects\xmlio.vcxproj.filters

?????文件???????4138??2016-03-14?09:53??xmlio\projects\xmliofulllib.vcproj

?????文件???????7234??2016-03-14?09:53??xmlio\projects\xmliolib.vcproj

?????文件???????8374??2016-03-14?09:53??xmlio\projects\xmliolib.vcxproj

?????文件???????2359??2016-03-14?09:53??xmlio\projects\xmliolib.vcxproj.filters

?????文件???????3881??2016-03-14?09:53??xmlio\projects\xmliolib2008.vcproj

?????文件???????9133??2016-03-14?09:53??xmlio\projects\xmliotest.cpp

?????文件???????7286??2016-03-14?09:53??xmlio\projects\xmltobin.vcproj

?????文件???????9081??2016-03-14?09:53??xmlio\projects\xmltobin.vcxproj

?????文件????????962??2016-03-14?09:53??xmlio\projects\xmltobin.vcxproj.filters

?????文件???????1762??2016-03-14?09:53??xmlio\readme.txt

?????文件???????1306??2016-03-14?09:53??xmlio\saxtest\ReadMe.txt

?????文件??????32091??2016-03-14?09:53??xmlio\saxtest\saxtest.cpp

?????文件???????4683??2016-03-14?09:53??xmlio\saxtest\saxtest.vcproj

?????文件????????294??2016-03-14?09:53??xmlio\saxtest\stdafx.cpp

?????文件???????1405??2016-03-14?09:53??xmlio\saxtest\stdafx.h

?????文件???????1490??2016-03-14?09:53??xmlio\src\abstractio.h

?????文件???????2033??2016-03-14?09:53??xmlio\src\msxmlio.cpp

?????文件???????3167??2016-03-14?09:53??xmlio\src\msxmlio.h

?????文件???????4767??2016-03-14?09:53??xmlio\src\octetsio.cpp

?????文件???????4657??2016-03-14?09:53??xmlio\src\octetsio.h

?????文件???????8581??2016-03-14?09:53??xmlio\src\octetsiobase.cpp

?????文件???????4521??2016-03-14?09:53??xmlio\src\octetsiobase.h

............此處省略25個文件信息

評論

共有 條評論

相關資源