commit 2025-08-24 00:20 add and test ZCppMainTest/ZtCLoadXml_000.cpp
This commit is contained in:
196
ZCppMainTest/ZtCLoadXml_000.cpp
Normal file
196
ZCppMainTest/ZtCLoadXml_000.cpp
Normal file
@ -0,0 +1,196 @@
|
||||
|
||||
|
||||
#include "ZCppMain/ZtCLoadXml.H"
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
namespace ZNsExam
|
||||
{
|
||||
|
||||
template<typename TDymmy=void*> class ZtExamLoadXml
|
||||
{
|
||||
public:
|
||||
|
||||
static int Main(int AI_ArgCnt=0, const char* APP_ArgVal[]=0)
|
||||
{
|
||||
typedef ZNsMain::ZtCStringBase<char> ZCStringData ;
|
||||
|
||||
typedef ZNsMain::ZNsViewIFace::ZNsExam::ZtCViewLoadXml<
|
||||
ZCStringData
|
||||
/*/////////*/ > ZCViewLoadXml; ////////////////////////
|
||||
typedef ZNsMain::ZNsType::ZtCTypeXmlInfo<
|
||||
ZCStringData
|
||||
/*/////////*/ > ZCTypeXmlInfo; ////////////////////////
|
||||
|
||||
typedef ZNsMain::ZtCXmlInfo<ZCTypeXmlInfo> ZCXmlInfo;
|
||||
typedef ZNsMain::ZNsView::ZtCViewLoadXmlOfXmlInfo<
|
||||
ZCXmlInfo
|
||||
/*/////////*/ > ZCViewLoadXmlOfXmlInfo; ///////////////
|
||||
typedef ZNsMain::ZtCLoadXml<ZCStringData> ZCLoadXml;
|
||||
|
||||
|
||||
const char* CPC_XmlData1=
|
||||
"<!-- My Comment0 --><? Header ?>\n"
|
||||
"<!DOCTYPE ele0[ \n"
|
||||
"<!ELEMENT ele1>\n"
|
||||
"<!ATTLIST prop>\n"
|
||||
"]>\n"
|
||||
"<ele0 prop0 = \"prop00\" /><!-- My Comment1 -->\n"
|
||||
"<ele1>ele1 data</ele1> <!-- My Comment2 -> ---- --->\n"
|
||||
"<ele2 >ele2 data</ele2>\n"
|
||||
"<요소3 prop1= \"prop1 value\" prop2 = \"prop2 value\" >"
|
||||
" <ele3_1 prop3=\"prop3 value\" prop33=\"prop33 value\" > MyData"
|
||||
" </ele3_1>\n"
|
||||
" <ele3_2 prop4=\"prop4 value\" prop44=\"prop44 value\" > <![CDATA[ myCDATA ]]>\n"
|
||||
" </ele3_2> \n"
|
||||
"</요소3"
|
||||
;
|
||||
const char* CPC_XmlData2=
|
||||
">\n<ele4 >ele4 data\n"
|
||||
"</ele4>\n"
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
const char* CPC_XmlDataOfID=
|
||||
"<?xml version=\"1.0\" encoding=\"euc-kr\" ?>\n"
|
||||
"<!DOCTYPE data[\n"
|
||||
"<!ELEMENT data ANY>\n"
|
||||
"<!ENTITY nbsp " " >\n"
|
||||
"<!ATTLIST data id ID #REQUIRED>\n"
|
||||
"]>\n"
|
||||
"<data id = \"id-set\" desc=\"Xml 로 출력되는 홈페이지의 내용 예시\">\n"
|
||||
"\n"
|
||||
" <data id=\"id-info-login\" login_enum=\"1\" login_msg=\"Login Already\" login_rightnum=\"515\"\n"
|
||||
" login_isadmin=\"0\" login_sessno=\"\" login_memno=\"1\" login_id=\"test\" login_name=\"\"\n"
|
||||
" login_icon=\"/testfile\" login_iconhtml=\"\" login_point=\"0\" login_mail=\"\" login_level=\"0\"\n"
|
||||
" login_no_fc=\"0\" login_no_fbinf=\"7\" login_notecnt=\"0\" login_type=\"0\" login_lastip=\"\"\n"
|
||||
" login_lastlogin=\"2008-09-28 08:29:51.904506\" login_filecnt=\"0\" login_filesum=\"0\"\n"
|
||||
" login_filemax=\"0\" />\n"
|
||||
"\n"
|
||||
" <data id=\"id-binfo-main\" binf_cntitem=\"12\" binf_cntpage=\"10\" binf_count=\"1001\" binf_maxnum=\"501\"\n"
|
||||
" binf_config=\"360943\" binf_bbit_fbinf=\"0\" binf_rn_fbinf=\"0\" binf_no_fc=\"0\" />\n"
|
||||
"\n"
|
||||
" <data id = \"id-binfo-var\" attcnt = \"0\" />\n"
|
||||
"\n"
|
||||
" <data id=\"id-binfo-top-set\" recordcnt=\"3\" fieldcnt=\"16\">\n"
|
||||
" <data id=\"id-binfo-top1\" no=\"1\" b_itemnum=\"1\" b_title=\"자유게시판입니다.\" b_tstyle=\"\"\n"
|
||||
" b_wdate=\"2008-09-28\" b_no=\"1\" b_depth=\"0\" b_hit=\"0\" b_commcnt=\"0\" b_filecnt=\"0\"\n"
|
||||
" b_userip=\"\" m_no=\"0\" m_point=\"0\" m_nick=\"\" m_userid=\"\" m_mail=\"\"\n"
|
||||
" f_icon=\"<img src="/testfile" class="member_img_icon" />\"\n"
|
||||
" />\n"
|
||||
" <data id=\"id-binfo-top2\" no=\"2\" b_itemnum=\"2\" b_title=\"술탄 메메트 2세 Title=2\" b_tstyle=\"\"\n"
|
||||
" b_wdate=\"2008-09-28\" b_no=\"2\" b_depth=\"0\" b_hit=\"0\" b_commcnt=\"0\" b_filecnt=\"0\" b_userip=\"\" m_no=\"0\" m_point=\"0\" m_nick=\"\" m_userid=\"\" m_mail=\"\"\n"
|
||||
" f_icon=\"<img src="/testfile" class="member_img_icon" />\"\n"
|
||||
" />\n"
|
||||
" <data id=\"id-binfo-top3\" no=\"3\" b_itemnum=\"1-1\" b_title=\"술탄 메메트 2세 Title=1-1\"\n"
|
||||
" b_tstyle=\"\" b_wdate=\"2008-09-28\" b_no=\"3\" b_depth=\"1\" b_hit=\"0\" b_commcnt=\"0\"\n"
|
||||
" b_filecnt=\"0\" b_userip=\"\" m_no=\"0\" m_point=\"0\" m_nick=\"\" m_userid=\"\" m_mail=\"\"\n"
|
||||
" f_icon=\"<img src="/testfile" class="member_img_icon" />\"\n"
|
||||
" />\n"
|
||||
" </data><!-- id=\"binfo-top-set\" -->\n"
|
||||
" <data id=\"id-binfo-modevar\" attcnt=\"5\" b_listbackcolor1=\"#ffeeff\" b_listbackcolor2=\"#cceedd\"\n"
|
||||
" b_listbackcolorcnt=\"2\" b_listlinecolor=\"black\" b_listmouseovercolor=\"#ffc0cb\" />\n"
|
||||
"\n"
|
||||
"</data><!-- id=\"id-set\" -->\n";
|
||||
/*const char* CPC_XmlDataOfID=*/
|
||||
|
||||
|
||||
ZCViewLoadXml VO_CViewLoadXml;
|
||||
ZCLoadXml VO_CLoadXml ;
|
||||
|
||||
VO_CLoadXml.Exec(VO_CViewLoadXml, CPC_XmlData1, ZNsMain::ZftLength(CPC_XmlData1));
|
||||
VO_CLoadXml.Exec(VO_CViewLoadXml, CPC_XmlData2, ZNsMain::ZftLength(CPC_XmlData2));
|
||||
|
||||
|
||||
cout<<endl;
|
||||
cout<<"## Show Xml Info With 'ID' Attribute. Press Enter. ##"; cin.get();
|
||||
|
||||
VO_CLoadXml.clear(); ZCViewLoadXmlOfXmlInfo VO_CViewLoadXmlOfXmlInfo;
|
||||
|
||||
ZNsMain::ZNsEnum::ZERunEx VE_ERunEx=VO_CLoadXml.ExecAll( ////////////
|
||||
VO_CViewLoadXmlOfXmlInfo,
|
||||
CPC_XmlDataOfID ,
|
||||
ZNsMain::ZftLength(CPC_XmlDataOfID)
|
||||
/*/////////*/ ); /*////////////////////////////////////////////////*/
|
||||
|
||||
if(VE_ERunEx!=ZNsMain::ZNsEnum::ZERunEx_OK)
|
||||
{
|
||||
cout<<endl<<endl<<
|
||||
"■ Error !! : Line="<<VO_CLoadXml.GetLineNo()<<", "<<
|
||||
"CharNo=" <<VO_CLoadXml.GetCharNo() <<", "<<
|
||||
"EWaitByte="<<VO_CLoadXml.GetMSG_EWaitByte() <<", "
|
||||
"Error MSG="<<VO_CViewLoadXmlOfXmlInfo.GetErrorMSG()<<endl;
|
||||
|
||||
cin.get(); return 0;
|
||||
}/*
|
||||
if(VE_ERunEx!=ZNsMain::ZNsEnum::ZERunEx_OK)*/
|
||||
|
||||
VO_CViewLoadXmlOfXmlInfo.GetCXmlInfo().IterPreOrderElementTreeStd();
|
||||
|
||||
cout<<endl;
|
||||
cout<<"## Show Xml ID ##"<<endl;
|
||||
cout<<endl;
|
||||
|
||||
VO_CViewLoadXmlOfXmlInfo.GetCXmlInfo().IterElementIDSetStd();
|
||||
|
||||
return 0;
|
||||
}/*
|
||||
static int Main(int AI_ArgCnt=0, const char* APP_ArgVal[]=0)*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
template<typename TDymmy=void*> class ZtExamLoadXml*/
|
||||
|
||||
}/*
|
||||
namespace ZNsExam*/
|
||||
|
||||
}/*
|
||||
namespace ZNsMain*/
|
||||
|
||||
|
||||
int main(int AR_ArgCnt, char* APP_ArgVal[])
|
||||
{
|
||||
return ZNsMain::ZNsExam::ZtExamLoadXml<>::Main();
|
||||
}/*
|
||||
int main(int AR_ArgCnt, char* APP_ArgVal[])*/
|
||||
|
||||
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ cigwin 컴파일
|
||||
|
||||
// g++ -mno-cygwin -o ZtCLoadXml_000.exe ZtCLoadXml_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300
|
||||
// g++ -mno-cygwin -o ZtCLoadXml_000_D.exe ZtCLoadXml_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300 -D_DEBUG
|
||||
|
||||
■ mingw 컴파일
|
||||
|
||||
// /usr/local/mingw/bin/g++.exe -o ZtCLoadXml_000.exe ZtCLoadXml_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300
|
||||
// /usr/local/mingw/bin/g++.exe -o ZtCLoadXml_000_D.exe ZtCLoadXml_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300 -D_DEBUG
|
||||
|
||||
■ Linux 컴파일
|
||||
|
||||
// g++ -o ZtCLoadXml_000.exe ZtCLoadXml_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/
|
||||
// g++ -o ZtCLoadXml_000_D.exe ZtCLoadXml_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D_DEBUG
|
||||
|
||||
■ Ubuntu 컴파일
|
||||
|
||||
g++ -o ZtCLoadXml_000.exe ZtCLoadXml_000.cpp -I../
|
||||
g++ -o ZtCLoadXml_000_D.exe ZtCLoadXml_000.cpp -I../ -D_DEBUG
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ gcc --version
|
||||
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ date
|
||||
Sun Aug 24 00:05:51 DST 2025
|
||||
|
||||
■ 실행
|
||||
|
||||
./ZtCLoadXml_000.exe
|
||||
./ZtCLoadXml_000_D.exe
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////*/
|
Reference in New Issue
Block a user