#ifndef __ZNSMAIN_ZTCLOADXML_H__ #define __ZNSMAIN_ZTCLOADXML_H__ #include "ZCppMain/ZtCStringEx.H" #include "ZCppMain/ZtCTreeData.H" #include "ZCppMain/ZtCObjList.H" #include "ZCppMain/ZtCObjAVL.H" namespace ZNsMain { namespace ZNsView { template class ZtCViewLoadXmlOfXmlInfo; }/* namespace ZNsView*/ namespace ZNsType { template< typename TStringData=ZNsMain::ZtCStringBase > class ZtCTypeXmlInfo //////////////////////////////////////// { public: typedef TStringData ZCStringData; typedef typename ZCStringData::ZCMainChars ZCMainChars ; typedef typename ZCStringData::TypeChar TypeChar ; typedef typename ZCStringData::TypeLength TypeLength ; public: // Xml 의 속성을 나타내는 클래스 class ZCAttribute { protected: ZCStringData mo_NameCStr ; ZCStringData mo_ValueCStr; public : ZCStringData& GetName (){return mo_NameCStr ;} ZCStringData& GetValue(){return mo_ValueCStr;} const ZCStringData& GetName () const{return mo_NameCStr ;} const ZCStringData& GetValue() const{return mo_ValueCStr;} ZCStringData& ConvertNormalValue() { return mo_ValueCStr. Replace(" " ,"\r" ). Replace(" " ,"\n" ). Replace(" " ,"\t" ). Replace(""","\"" ). Replace(">" ,">" ). Replace("<" ,"<" ). Replace("&" ,"&" ); }/* ZCStringData& ConvertNormalValue()*/ public: };/* class ZCAttribute*/ typedef ZNsMain::ZtCObjList ZCAttriList; // Xml 의 Element 를 나타내는 클래스 class ZCElement { public : typedef typename ZCStringData::TypeChar TypeChar ; typedef typename ZCStringData::TypeLength TypeLength; protected: ZTypInt mi_EleDepth ; protected: ZCAttriList mo_CAttriList ; ZCStringData mo_NameCStr ; ZCStringData mo_ContentCStr; public : ZCElement() { mi_EleDepth=0; }/* ZCElement()*/ void clear() { mo_CAttriList .clear(); mo_NameCStr .clear(); mo_ContentCStr.clear(); }/* void clear()*/ ZTypInt GetDepth() const { return this->mi_EleDepth; }/* ZTypInt GetDepth() const*/ void SetDepth(ZTypInt AI_Depth) { this->mi_EleDepth=AI_Depth; }/* void SetDepth(ZTypInt AI_Depth)*/ ZCAttriList& GetCAttriList() { return this->mo_CAttriList; }/* ZCAttriList& GetCAttriList()*/ ZCAttribute& AddTailDefaultAttrib() { return (ZCAttribute&)this->mo_CAttriList; }/* ZCAttribute& AddTailDefaultAttrib()*/ ZCStringData& GetName (){return this->mo_NameCStr ;} ZCStringData& GetContent(){return this->mo_ContentCStr;} ZCStringData& ConvertNormalContent() { return this->mo_ContentCStr. Replace("
","\n"). Replace(" "," " ). Replace("<" ,"<" ). Replace(">" ,">" ). Replace("&" ,"&" ); }/* ZCStringData& ConvertNormalContent()*/ // 어떤 속성명에 대한 속성값 포인터를 가져온다. ZCStringData* GetAttriValuePtr(const ZCStringData& AR_CStringAttri) { ZTypIntL VL_ListSize =mo_CAttriList.size (); IterEasyID VI_IterEasyID=mo_CAttriList.ItHID(); __for1(ZTypIntL, i, VL_ListSize) { if(mo_CAttriList.ItD(VI_IterEasyID).GetName()==AR_CStringAttri) { return &mo_CAttriList.ItD(VI_IterEasyID).GetValue(); } /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/ mo_CAttriList.ItNext(RR(VI_IterEasyID)); }/* __for1(ZTypIntL, i, VL_ListSize)*/ return 0; }/* ZCStringData* GetAttriValuePtr(const ZCStringData& AR_CStringAttri)*/ const ZCStringData* GetAttriValuePtr(const ZCStringData& AR_CStringAttri) const { ZTypIntL VL_ListSize =mo_CAttriList.size (); IterEasyID VI_IterEasyID=mo_CAttriList.ItHID(); __for1(ZTypIntL, i, VL_ListSize) { if(mo_CAttriList.ItD(VI_IterEasyID).GetName()==AR_CStringAttri) { return &mo_CAttriList.ItD(VI_IterEasyID).GetValue(); } /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/ mo_CAttriList.ItNext(RR(VI_IterEasyID)); }/* __for1(ZTypIntL, i, VL_ListSize)*/ return 0; }/* const ZCStringData* GetAttriValuePtr(const ZCStringData& AR_CStringAttri) const*/ ZCStringData* GetAttriValuePtr(const TypeChar* AP_AttriName, TypeLength AL_AttriLen) { ZTypIntL VL_ListSize =mo_CAttriList.size (); IterEasyID VI_IterEasyID=mo_CAttriList.ItHID(); __for1(ZTypIntL, i, VL_ListSize) { const bool CB_IsTrue = /*<<<<<<<<<<<<<*/ ( ZCMainChars::Minus ( mo_CAttriList.ItD(VI_IterEasyID).GetName().data(), AP_AttriName, mo_CAttriList.ItD(VI_IterEasyID).GetName().size(), AL_AttriLen ) ==0 ); /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ if(CB_IsTrue) return &mo_CAttriList.ItD(VI_IterEasyID).GetValue(); mo_CAttriList.ItNext(RR(VI_IterEasyID)); }/* __for1(ZTypIntL, i, VL_ListSize)*/ return 0; }/* ZCStringData* GetAttriValuePtr(const TypeChar* AP_AttriName, TypeLength AL_AttriLen)*/ const ZCStringData* GetAttriValuePtr(const TypeChar* AP_AttriName, TypeLength AL_AttriLen) const { ZTypIntL VL_ListSize =mo_CAttriList.size (); IterEasyID VI_IterEasyID=mo_CAttriList.ItHID(); __for1(ZTypIntL, i, VL_ListSize) { #define _COMPARE_ARG_ \ mo_CAttriList.ItD(VI_IterEasyID).GetName().data(), \ AP_AttriName, \ mo_CAttriList.ItD(VI_IterEasyID).GetName().size(), \ AL_AttriLen if(ZCMainChars::Minus(_COMPARE_ARG_)==0) { return &mo_CAttriList.ItD(VI_IterEasyID).GetValue(); }/* if(ZCMainChars::Minus(_COMPARE_ARG_)==0)*/ #undef _COMPARE_ARG_ mo_CAttriList.ItNext(RR(VI_IterEasyID)); }/* __for1(ZTypIntL, i, VL_ListSize)*/ return 0; }/* const ZCStringData* GetAttriValuePtr(const TypeChar* AP_AttriName, TypeLength AL_AttriLen) const*/ const ZCAttriList & GetCAttriList() const{return this->mo_CAttriList ;} const ZCStringData& GetName () const{return this->mo_NameCStr ;} const ZCStringData& GetContent () const{return this->mo_ContentCStr;} public: };/* class ZCElement*/ typedef ZNsMain::ZtCTreeData ZCElementTree; typedef typename ZCElementTree::ZCNode ZCElementNode; /*/////////////////////////////////////////////////////////////////////////// ■ class ZCElementID<> 은 XML 의 각 Element 의 고유 ID 정보를 따로 관리한다. 그래서 ID 만으로 해당 요소에 접근할 수 있게 하는 것이다. ZCElementID 를 사용하는 클래스에서 ZCElementID 의 멤버를 노출하는 interface 는 작성하지 말아야 한다. ///////////////////////////////////////////////////////////////////////////*/ class ZCElementID { public : /* class ZtCViewLoadXmlOfXmlInfo<> 에서 ZCElementID::SetEleNodePtr(~) 에 접근할 수 있게 하는 friend 선언. */ template friend class ZNsView::ZtCViewLoadXmlOfXmlInfo; private: ZCStringData* mp_CStringID; mutable ZCElementNode* mp_CEleNode ; private: void SetEleNodePtr(ZCElementNode* AP_NodePtr) const { mp_CEleNode=AP_NodePtr; }/* void SetEleNodePtr(ZCElementNode* AP_NodePtr) const*/ /*private:*/ public : ZCElementID() { mp_CStringID=0; mp_CEleNode =0; }/* ZCElementID()*/ const ZCStringData& GetID () const{return *mp_CStringID;} const ZCStringData* GetIDPtr () const{return mp_CStringID ;} const ZCStringData& GetContent () const{return mp_CEleNode->GetData().GetContent();} const ZCAttriList* GetCAttriListPtr() const { return mp_CEleNode==0 ? 0 : &mp_CEleNode->GetData().GetCAttriList(); }/* const ZCAttriList* GetCAttriListPtr() const*/ ZCStringData* GetAttriValuePtr(const ZCStringData& AR_CStringAttri) { return mp_CEleNode==0 ? 0 : mp_CEleNode->GetData().GetAttriValuePtr(AR_CStringAttri); }/* ZCStringData* GetAttriValuePtr(const ZCStringData& AR_CStringAttri)*/ const ZCStringData* GetAttriValuePtr(const ZCStringData& AR_CStringAttri) const { return mp_CEleNode->GetData().GetAttriValuePtr(AR_CStringAttri); }/* const ZCStringData* GetAttriValuePtr(const ZCStringData& AR_CStringAttri) const*/ ZCStringData* GetAttriValuePtr(const TypeChar* AP_AttriName, TypeLength AL_AttriLen) { return mp_CEleNode->GetData().GetAttriValuePtr(AP_AttriName, AL_AttriLen); }/* ZCStringData* GetAttriValuePtr(const TypeChar* AP_AttriName, TypeLength AL_AttriLen)*/ const TStringData* GetAttriValuePtr(const TypeChar* AP_AttriName, ZTypIntL AL_AttriLen) const { return mp_CEleNode->GetData().GetAttriValuePtr(AP_AttriName, AL_AttriLen); }/* const TStringData* GetAttriValuePtr(const TypeChar* AP_AttriName, ZTypIntL AL_AttriLen) const*/ ZCElementNode* GetEleNodePtr() { return mp_CEleNode; }/* ZCElementNode* GetEleNodePtr()*/ const ZCElementNode* GetEleNodePtr() const { return mp_CEleNode; }/* const ZCElementNode* GetEleNodePtr() const*/ ZCElementID& operator=(const ZCStringData& AR_CStringData){*mp_CStringID=AR_CStringData; return *this;} ZCElementID& operator=( ZCStringData* AP_CStringData){ mp_CStringID=AP_CStringData; return *this;} bool operator==(const ZCElementID& rhs) const{return *mp_CStringID==*rhs.mp_CStringID ;} bool operator> (const ZCElementID& rhs) const{return *mp_CStringID> *rhs.mp_CStringID ;} bool operator< (const ZCElementID& rhs) const{return *mp_CStringID< *rhs.mp_CStringID ;} bool operator==(const ZCStringData& AR_CStringData) const{return *mp_CStringID==AR_CStringData ;} bool operator> (const ZCStringData& AR_CStringData) const{return *mp_CStringID> AR_CStringData ;} bool operator< (const ZCStringData& AR_CStringData) const{return *mp_CStringID< AR_CStringData ;} bool operator==(const ZCStringData* AP_CStringData) const{return *mp_CStringID==*AP_CStringData ;} bool operator> (const ZCStringData* AP_CStringData) const{return *mp_CStringID> *AP_CStringData ;} bool operator< (const ZCStringData* AP_CStringData) const{return *mp_CStringID< *AP_CStringData ;} bool operator==(const TypeChar* AP_CharID) const{return *mp_CStringID==AP_CharID ;} bool operator> (const TypeChar* AP_CharID) const{return *mp_CStringID> AP_CharID ;} bool operator< (const TypeChar* AP_CharID) const{return *mp_CStringID< AP_CharID ;} int Compare(const ZCElementID& rhs ) const{return *mp_CStringID - *rhs.mp_CStringID ;} int Compare(const ZCStringData& AR_CStringData) const{return *mp_CStringID - AR_CStringData ;} int Compare(const ZCStringData* AP_CStringData) const{return *mp_CStringID - *AP_CStringData ;} int Compare(const TypeChar* AP_CharID ) const{return *mp_CStringID - AP_CharID ;} public: };/* class ZCElementID*/ typedef ZNsMain::ZtCObjAVL ZCElementIDSet ; typedef typename ZCElementIDSet::ZCNode ZCElementIDNode; };/* template< typename TStringData=ZNsMain::ZtCStringBase > class ZtCTypeXmlInfo //////////////////////////////////////*/ }/* namespace ZNsType*/ template< typename TTypeXmlInfo=ZNsType::ZtCTypeXmlInfo<> > class ZtCXmlInfo ////////////////////////////////////////// { public : typedef TTypeXmlInfo TypeData ; typedef typename TTypeXmlInfo::ZCStringData ZCStringData ; typedef typename TTypeXmlInfo::ZCAttribute ZCAttribute ; typedef typename TTypeXmlInfo::ZCAttriList ZCAttriList ; typedef typename TTypeXmlInfo::ZCElement ZCElement ; typedef typename TTypeXmlInfo::ZCElementTree ZCElementTree ; typedef typename TTypeXmlInfo::ZCElementNode ZCElementNode ; typedef typename TTypeXmlInfo::ZCElementID ZCElementID ; typedef typename TTypeXmlInfo::ZCElementIDSet ZCElementIDSet ; typedef typename TTypeXmlInfo::ZCElementIDNode ZCElementIDNode; public : typedef typename ZCStringData::ZCMainChars ZCMainChars ; typedef typename ZCStringData::TypeChar TypeChar ; typedef typename ZCStringData::TypeLength TypeLength ; private: ZCElementTree mo_CElementTree ; ZCElementIDSet mo_CElementIDSet; public : /**/ ZCElementTree& GetCElementTree () {return mo_CElementTree ;} /**/ ZCElementIDSet& GetCElementIDSet() {return mo_CElementIDSet;} public : const ZCElementTree& GetCElementTree ()const{return mo_CElementTree ;} const ZCElementIDSet& GetCElementIDSet()const{return mo_CElementIDSet;} void clear() { mo_CElementIDSet.clear(); mo_CElementTree .clear(); mo_CElementTree . GetRootNode().GetData().clear(); // 아주 중요한 코드이다. }/* void clear()*/ const ZCStringData* GetElementValuePtrByID(const ZCStringData& AR_CStringID) const { const ZCElementIDNode* VP_CEleIDNode = this->mo_CElementIDSet.FindKey(AR_CStringID); if(VP_CEleIDNode) return &VP_CEleIDNode->GetData(). GetEleNodePtr()->GetData().GetContent(); else return 0; }/* const ZCStringData* GetElementValuePtrByID(const ZCStringData& AR_CStringID) const*/ const ZCStringData* GetElementValuePtrByID(const TypeChar* AP_CharID) const { const ZCElementIDNode* VP_CEleIDNode = this->mo_CElementIDSet.FindKey(AP_CharID); if(VP_CEleIDNode) return &VP_CEleIDNode->GetData(). GetEleNodePtr()->GetData().GetContent(); else return 0; }/* const ZCStringData* GetElementValuePtrByID(const TypeChar* AP_CharID) const*/ void GetElementValueByID /*####################################################*/ ( const ZCStringData& AR_CStringID, ZCStringData& ARR_CStringSave ) const /*#############################################################################*/ { const ZCElementIDNode* VP_CEleIDNode = this->mo_CElementIDSet.FindKey(AR_CStringID); if(VP_CEleIDNode) ARR_CStringSave=VP_CEleIDNode->GetData(). GetEleNodePtr()->GetData().GetContent() ; }/* void GetElementValueByID(const ZCStringData& AR_CStringID, ZCStringData& ARR_CStringSave) const*/ void GetElementValueByID /*####################################################*/ ( const TypeChar* AP_CharID, ZCStringData& ARR_CStringSave ) const /*#############################################################################*/ { const ZCElementIDNode* VP_CEleIDNode = this->mo_CElementIDSet.FindKey(AP_CharID); if(VP_CEleIDNode) ARR_CStringSave = VP_CEleIDNode->GetData(). GetEleNodePtr()->GetData().GetContent() ; }/* void GetElementValueByID ######################################################## ( const TypeChar* AP_CharID, ZCStringData& ARR_CStringSave ) const /*#############################################################################*/ ZCStringData GetElementValueByID(const ZCStringData& AR_CStringID) const { ZCStringData VO_SaveCStr; GetElementValueByID(AR_CStringID, RR(VO_SaveCStr)); return VO_SaveCStr; } ZCStringData GetElementValueByID(const TypeChar* AP_CharID ) const { ZCStringData VO_SaveCStr; GetElementValueByID(AP_CharID , RR(VO_SaveCStr)); return VO_SaveCStr; }/* ZCStringData GetElementValueByID(const TypeChar* AP_CharID ) const*/ const ZCStringData* GetAttriValuePtrByID /*####################################*/ ( const ZCStringData& AR_CStringID, const ZCStringData& AR_CStringAttri ) const /*#############################################################################*/ { const ZCElementIDNode* VP_CEleIDNode = this->mo_CElementIDSet.FindKey(AR_CStringID); if(VP_CEleIDNode) return VP_CEleIDNode->GetData(). GetAttriValuePtr(AR_CStringAttri); else return 0; } /*#############################################################################*/ const ZCStringData* GetAttriValuePtrByID /*####################################*/ ( const TypeChar* AP_CharID, const TypeChar* AP_CharAttri ) const /*#############################################################################*/ { const ZCElementIDNode* VP_CEleIDNode = this->mo_CElementIDSet.FindKey(AP_CharID); if(VP_CEleIDNode) return VP_CEleIDNode->GetData().GetAttriValuePtr ( AP_CharAttri, ZftLength(AP_CharAttri) ); else return 0; } /*#############################################################################*/ void GetAttriValueByID(const ZCStringData& AR_CStringID, const ZCStringData& AR_CStringAttri, ZCStringData& ARR_CStringSave) const { const ZCStringData* VP_CStringSave= 0 ; const ZCElementIDNode* VP_CEleIDNode = this->mo_CElementIDSet.FindKey(AR_CStringID); if(VP_CEleIDNode==0) return; VP_CStringSave = VP_CEleIDNode-> GetData().GetAttriValuePtr(AR_CStringAttri); if(VP_CStringSave!=0) ARR_CStringSave = *VP_CStringSave; }/* void GetAttriValueByID(const ZCStringData& AR_CStringID, const ZCStringData& AR_CStringAttri, ZCStringData& ARR_CStringSave) const*/ void GetAttriValueByID(const TypeChar* AP_CharID, const TypeChar* AP_CharAttri, ZCStringData& ARR_CStringSave) const { const ZCStringData* VP_CStringSave = 0 ; const ZCElementIDNode* VP_CEleIDNode = this->mo_CElementIDSet.FindKey(AP_CharID); if(VP_CEleIDNode==0) return; VP_CStringSave =VP_CEleIDNode->GetData(). GetAttriValuePtr(AP_CharAttri, ZftLength(AP_CharAttri)); if(VP_CStringSave!=0) ARR_CStringSave = *VP_CStringSave; }/* void GetAttriValueByID(const TypeChar* AP_CharID, const TypeChar* AP_CharAttri, ZCStringData& ARR_CStringSave) const*/ ZCStringData GetAttriValueByID /*##############################################*/ ( const ZCStringData& AR_CStringID, const ZCStringData& AR_CStringAttri ) const /*#############################################################################*/ { ZCStringData VO_SaveValueCStr; GetAttriValueByID ( AR_CStringID, AR_CStringAttri, RR(VO_SaveValueCStr) ); return VO_SaveValueCStr; //////////////////////// } /*#############################################################################*/ ZCStringData GetAttriValueByID /*##############################################*/ ( const TypeChar* AP_CharID, const TypeChar* AP_CharAttri ) const /*#############################################################################*/ { ZCStringData VO_SaveValueCStr; GetAttriValueByID ( AP_CharID, AP_CharAttri, RR(VO_SaveValueCStr) ); return VO_SaveValueCStr; /////////////////////// } /*#############################################################################*/ ZTypIntL GetAttriValLongByID /*################################################*/ ( const ZCStringData& AR_CStringID , const ZCStringData& AR_CStringAttri , ZTypIntL* APL_Value = 0 ) const /*#############################################################################*/ { ZCStringData VO_CStringSave; GetAttriValueByID( AR_CStringID, AR_CStringAttri, RR(VO_CStringSave)); if(VO_CStringSave.size()<1) return APL_Value!=0 ? *APL_Value : 0; /////// if(APL_Value==0) return VO_CStringSave.GetLong(); return *APL_Value=VO_CStringSave.GetLong(); ///// } /*#############################################################################*/ ZTypIntL GetAttriValLongByID /*################################################*/ ( const TypeChar* AP_CharID , const TypeChar* AP_CharAttri, ZTypIntL* APL_Value = 0 ) const /*#############################################################################*/ { ZCStringData VO_CStringSave; GetAttriValueByID ( AP_CharID, AP_CharAttri, RR(VO_CStringSave) ); if(VO_CStringSave.size()<1) return APL_Value!=0 ? *APL_Value : 0; if(APL_Value==0) return VO_CStringSave.GetLong(); else return *APL_Value = VO_CStringSave.GetLong(); } /*#############################################################################*/ class ZCFunctor_Element { public: void operator()(ZCElement& AR_CElement, int AI_StartDepth, int AI_Index) { ZCStringData VO_CStringTemp; VO_CStringTemp.resize(AI_StartDepth*4,TypeChar(' ')); const TypeChar* VP_Tab =VO_CStringTemp .size() >0 ? VO_CStringTemp.data() : "" ; const TypeChar* VP_Name =AR_CElement.GetName() .size() >0 ? AR_CElement.GetName().data() : "(NULL)" ; const TypeChar* VP_Content=AR_CElement.GetContent().size() >0 ? AR_CElement.GetContent().data(): "(NULL)" ; const TypeChar* VP_AttriName ; const TypeChar* VP_AttriValue; cout<0 ? VO_CStringTemp.data() : "" ; const TypeChar* VP_Name =AR_CElement.GetName() .size() >0 ? AR_CElement.GetName().data() : "(NULL)" ; const TypeChar* VP_Content=AR_CElement.GetContent().size() >0 ? AR_CElement.GetContent().data(): "(NULL)" ; const TypeChar* VP_AttriName ; const TypeChar* VP_AttriValue; cout<0 ? VO_CStringTemp.data() : "" ; // const TypeChar* VP_Name =AR_CElement.GetName() .size() >0 ? AR_CElement.GetName().data() : "(NULL)" ; // const TypeChar* VP_Content=AR_CElement.GetContent().size() >0 ? AR_CElement.GetContent().data(): "(NULL)" ; mo_PropName = AR_CElement.GetName(); mr_SaveBuff(VO_CStringTemp)(TypeChar('<')) ( AR_CElement.GetName() )( TypeChar(' ') ) ; IterEasyID VP_AttriIterEasyID = AR_CElement.GetCAttriList().ItHID(); int VI_AttriListSize = AR_CElement.GetCAttriList().size(); for(int i=1; i<=VI_AttriListSize; ++i) { VO_CStringTemp = AR_CElement. GetCAttriList().ItD(VP_AttriIterEasyID).GetValue(); ZftMakeXmlAttEnc(VO_CStringTemp); mr_SaveBuff( AR_CElement.GetCAttriList(). ItD(VP_AttriIterEasyID).GetName()) (TypeChar('=')); mr_SaveBuff (TypeChar('"')) (VO_CStringTemp) (TypeChar('"')) (TypeChar(' ') ); AR_CElement.GetCAttriList().ItNext(RR(VP_AttriIterEasyID)); }/* for(int i=1; i<=VI_AttriListSize; ++i)*/ mr_SaveBuff(TypeChar('/'))(TypeChar('>'))(TypeChar('\n')); }/* void operator()(ZCElement& AR_CElement, int AI_StartDepth, int AI_Index)*/ ZERun OnDataBody(const ZCElement& AR_CElement, int AI_StartDepth, int AI_Index) { const int CI_TabSize = 4 ; ZCStringData VO_CStringTemp ; VO_CStringTemp.resize (AI_StartDepth*CI_TabSize, TypeChar(' ')); // const TypeChar* VP_Tab =VO_CStringTemp. size() >0 ? VO_CStringTemp.data() : "" ; // const TypeChar* VP_Name =AR_CElement.GetName() .size() >0 ? AR_CElement.GetName().data() : "(NULL)" ; // const TypeChar* VP_Content=AR_CElement.GetContent().size() >0 ? AR_CElement.GetContent().data(): "(NULL)" ; mo_PropName = AR_CElement.GetName(); mr_SaveBuff(VO_CStringTemp) (TypeChar('<') ) (AR_CElement.GetName()) (TypeChar(' ') ); //////////////////////////////////// IterEasyID VP_AttriIterEasyID = AR_CElement.GetCAttriList().ItHID(); int VI_AttriListSize = AR_CElement.GetCAttriList().size(); for(int i=1; i<=VI_AttriListSize; ++i) { VO_CStringTemp = AR_CElement. GetCAttriList().ItD(VP_AttriIterEasyID).GetValue(); ZNsMain::ZftMakeXmlAttEnc(VO_CStringTemp); mr_SaveBuff (AR_CElement.GetCAttriList(). ItD(VP_AttriIterEasyID).GetName()) (TypeChar('=')); mr_SaveBuff (TypeChar('"')) (VO_CStringTemp) (TypeChar('"')) (TypeChar(' ') ); AR_CElement.GetCAttriList(). ItNext( RR(VP_AttriIterEasyID) ); }/* for(int i=1; i<=VI_AttriListSize; ++i)*/ mr_SaveBuff(TypeChar('>'))(TypeChar('\n')); return ZERun_OK; /*>>>>>>>>>>>>>>>>>>>>>>*/ }/* ZERun OnDataBody(const ZCElement& AR_CElement, int AI_StartDepth, int AI_Index)*/ ZERun OnSubNodeStart(int AI_Depth, int AI_NodeCnt){return ZERun_OK;} ZERun OnSubNodeClose(int AI_Depth, int AI_NodeCnt) { const int CI_TabSize = 4 ; ZCStringData VO_CStringTemp ; VO_CStringTemp.resize( AI_Depth*CI_TabSize, TypeChar(' ') ); mr_SaveBuff(VO_CStringTemp) ///////////// (TypeChar('<')) (TypeChar('/'))(mo_PropName) (TypeChar('>')) (TypeChar('\n')); ///////////////////////////////////////// return ZERun_OK; }/* ZERun OnSubNodeClose(int AI_Depth, int AI_NodeCnt)*/ public: };/* class ZCFunctor_SaveBuff*/ template void IterPreOrderElementTree(TFunctor AO_Functor) { // cf) TFunctor::operator()(ZCElement, AI_StartDepth, AI_Index); mo_CElementTree.GetRootNode().IterPreOrder(AO_Functor); }/* template void IterPreOrderElementTree(TFunctor AO_Functor) */ void IterPreOrderElementTreeStd() { ZCFunctor_Element VO_CFunctor_Element; this->IterPreOrderElementTree(VO_CFunctor_Element); }/* void IterPreOrderElementTreeStd()*/ void IterPreOrderElementTreeSave(ZCStringData& ARR_BuffStr) { ZCFunctor_SaveBuff VO_CFunctor_SaveBuff(ARR_BuffStr); this->IterPreOrderElementTree(VO_CFunctor_SaveBuff); }/* void IterPreOrderElementTreeSave(ZCStringData& ARR_BuffStr)*/ class CFunctor_ElementID { private: ZCStringData mo_BuffCStr; bool mb_SaveBuff; public : CFunctor_ElementID() { mb_SaveBuff=false; }/* CFunctor_ElementID()*/ bool DoSaveBuff() const{return mb_SaveBuff;} void SetSaveBuffBool(bool AB_DoSaveBuff) const { mb_SaveBuff=AB_DoSaveBuff; } ////////////////////////////////////////////// ZCStringData& GetBuffCStr() {return mo_BuffCStr;} const ZCStringData& GetBuffCStr() const{return mo_BuffCStr;} /*public :*/ public : void operator()(const ZCElementID& AR_CElementID) { const TypeChar* VP_ID =AR_CElementID.GetID().size() <1 ? "(NULL)" : AR_CElementID.GetID() .data() ; const TypeChar* VP_Content=AR_CElementID.GetContent().size()<1 ? "NULL" : AR_CElementID.GetContent().data() ; if(mb_SaveBuff==false) cout<<"# ID="< void IterElementIDSet(TFunctor AO_Functor) { mo_CElementIDSet.IterNode(AO_Functor); // cf) TFunctor::operator()(ZCElementID); }/* template void IterElementIDSet(TFunctor AO_Functor) */ void IterElementIDSetStd() { CFunctor_ElementID VO_CFunctor_ElementID; this->IterElementIDSet(VO_CFunctor_ElementID); }/* void IterElementIDSetStd()*/ void IterElementIDSetStd(CFunctor_ElementID& AR_CFunctor) { this->IterElementIDSet(AR_CFunctor); }/* void IterElementIDSetStd(CFunctor_ElementID& AR_CFunctor)*/ public: };/* template< typename TTypeXmlInfo=ZNsType::ZtCTypeXmlInfo<> > class ZtCXmlInfo ////////////////////////////////////////*/ namespace ZNsViewIFace { /*/////////////////////////////////////////////////////////////////////////////////////////// ■ 아래 On~ 계열의 멤버 함수는 ERun 이 아닌 ZERunEx 를 반환하게 되어 있다. 이게 좋은 설계일까. 꼭 에러가 아니라 할지라도 실행 중지(ZERunEx_NO)를 반환하여 XML 처리를 중지시키고 싶은 경우 가 있지 않을까. 그렇다면 실행 중지(ZERunEx_NO)와 실행 에러(ZERunEx_Err)를 구별하는 ZERunEx 를 반환하는 것이 좋을 것 같다. -- 2013-06-05 14:34:00 ///////////////////////////////////////////////////////////////////////////////////////////*/ template class ZtCViewLoadXml { public: typedef TStringData /*##################*/ ZCStringData; public: typedef typename ZCStringData::TypeChar TypeChar ; typedef typename ZCStringData::TypeLength TypeLength ; typedef typename ZCStringData::TypeAlloc TypeAlloc ; typedef typename ZCStringData::ZCTypeChars ZCTypeChars ; typedef typename ZCStringData::ZCMainChars ZCMainChars ; typedef typename ZCStringData::ZCStringList ZCStringList; public: template void InitExec(TLoadXml& AR_CLoadXml){} template void FiniExec(TLoadXml& AR_CLoadXml){} template ZERunEx OnError(TLoadXml& AR_CLoadXml, TypeChar AC_Char){return ZERunEx_Err;} template ZERunEx OnNoHeader (TLoadXml&){return ZERunEx_OK;} template ZERunEx OnHeaderStart (TLoadXml&){return ZERunEx_OK;} template ZERunEx OnHeaderBody (TLoadXml&, const TypeChar* APC_Data, TypeLength AI_Length){return ZERunEx_OK;} template ZERunEx OnHeaderBody (TLoadXml&, TypeChar AC_Char){return ZERunEx_OK;} template ZERunEx OnHeaderClose (TLoadXml&){return ZERunEx_OK;} template ZERunEx OnNoDTD (TLoadXml&){return ZERunEx_OK;} template ZERunEx OnDTDStart (TLoadXml&){return ZERunEx_OK;} template ZERunEx OnDTDRootStart (TLoadXml&){return ZERunEx_OK;} template ZERunEx OnDTDRootBody (TLoadXml&, const TypeChar* APC_Data, TypeLength AI_Length){return ZERunEx_OK;} template ZERunEx OnDTDRootClose (TLoadXml&){return ZERunEx_OK;} template ZERunEx OnDTDBigStart (TLoadXml&){return ZERunEx_OK;} template ZERunEx OnDTDBigBody (TLoadXml&, const TypeChar* APC_Data, TypeLength AI_Length){return ZERunEx_OK;} template ZERunEx OnDTDBigClose (TLoadXml&){return ZERunEx_OK;} template ZERunEx OnDTDSmallStart(TLoadXml&){return ZERunEx_OK;} template ZERunEx OnDTDSmallBody (TLoadXml&, const TypeChar* APC_Data, TypeLength AI_Length){return ZERunEx_OK;} template ZERunEx OnDTDSmallClose(TLoadXml&){return ZERunEx_OK;} template ZERunEx OnDTDClose (TLoadXml&){return ZERunEx_OK;} template ZERunEx OnCommentStart(TLoadXml&){return ZERunEx_OK;} template ZERunEx OnCommentBody (TLoadXml&, TypeChar AC_Char){return ZERunEx_OK;} template ZERunEx OnCommentBody (TLoadXml&, const TypeChar* APC_Data, TypeLength AI_Length){return ZERunEx_OK;} template ZERunEx OnCommentClose(TLoadXml&){return ZERunEx_OK;} template ZERunEx OnElementStart (TLoadXml&){return ZERunEx_OK;} template ZERunEx OnElementNameStart (TLoadXml&){return ZERunEx_OK;} template ZERunEx OnElementNameBody (TLoadXml&, const TypeChar* APC_Data, TypeLength AI_Length){return ZERunEx_OK;} template ZERunEx OnElementNameClose (TLoadXml&,int AI_Depth){return ZERunEx_OK;} template ZERunEx OnElementPropNameStart (TLoadXml&){return ZERunEx_OK;} template ZERunEx OnElementPropNameBody (TLoadXml&, const TypeChar* APC_Data, TypeLength AI_Length){return ZERunEx_OK;} template ZERunEx OnElementPropNameClose (TLoadXml&){return ZERunEx_OK;} template ZERunEx OnElementPropValueStart(TLoadXml&){return ZERunEx_OK;} template ZERunEx OnElementPropValueBody (TLoadXml&, const TypeChar* APC_Data, TypeLength AI_Length){return ZERunEx_OK;} template ZERunEx OnElementPropValueClose(TLoadXml&){return ZERunEx_OK;} template ZERunEx OnElementValueStart(TLoadXml&){return ZERunEx_OK;} /*//////////////////////////////////////////////////////////////////////////////////////////// ■ OnElementValueStart() 라는 함수가 있다면, OnElementValueClose() 라는 함수도 있는 있는 것이 좋겠지만, 이 역할을 OnElementClose() 가 하고 있기 때문에, OnElementValueClose() 함수는 선언하지 않는다. 즉 OnElementClose() 함수가 호출되면, 요소의 값도 끝난 것이 된다. -- 2011-09-25 22:29:00 ■ OnElementName2~() 계열의 함수는 요소의 끝 부분이 "" 형태로 되어있는 부분에서 "요소명" 부분을 처리한다. 따라서 이 "요소명"이 OnElementNameClose() 에서 알아낸 "요소명", 즉 요소의 처음 부분에서 지정된 "요소명"과 같은 지 체크해서, 다르면 에러 처리를 한다. -- 2011-10-22 10:26:00 ////////////////////////////////////////////////////////////////////////////////////////////*/ template ZERunEx OnElementName2Start(TLoadXml&){return ZERunEx_OK;} // "" 형태에서 "요소명" 이 시작하는 경우. template ZERunEx OnElementName2Body (TLoadXml&, const TypeChar* APC_Data, TypeLength AI_Length){return ZERunEx_OK;} template ZERunEx OnElementName2Close(TLoadXml&){return ZERunEx_OK;} /*///////////////////////////////////////////////////////////////////////////////////////// ■ OnEleCDATA_Start(), OnEleCDATA_Close(), OnElePCDATA_Start(), OnElePCDATA_Close() 는 같은 요소에 대하여 1 회만 호출되어야 한다. 이 함수 내부에서 이 조건을 체크할 필요가 있다. -- 2011-09-20 03:25:00 /////////////////////////////////////////////////////////////////////////////////////////*/ template ZERunEx OnEleCDATA_Start(TLoadXml&){return ZERunEx_OK;/*같은 요소에 대하여 중복 호출 체크*/} template ZERunEx OnEleCDATA_Body (TLoadXml&, const TypeChar* APC_Data, TypeLength AI_Length){return ZERunEx_OK;} template ZERunEx OnEleCDATA_Body (TLoadXml&, TypeChar AC_Char){return ZERunEx_OK;} template ZERunEx OnEleCDATA_Close(TLoadXml&){return ZERunEx_OK;/*같은 요소에 대하여 중복 호출 체크*/} template ZERunEx OnElePCDATA_Start(TLoadXml&){return ZERunEx_OK;/*같은 요소에 대하여 중복 호출 체크*/} template ZERunEx OnElePCDATA_Body (TLoadXml&, const TypeChar* APC_Data, TypeLength AI_Length){return ZERunEx_OK;} template ZERunEx OnElePCDATA_Body (TLoadXml&, TypeChar AC_Char){return ZERunEx_OK;} template ZERunEx OnElePCDATA_Close(TLoadXml&){return ZERunEx_OK;/*같은 요소에 대하여 중복 호출 체크*/} template ZERunEx OnElementClose(TLoadXml&, bool AB_DoHaveSlash=false) { // AB_DoHaveSlash==true 이면 요소의 값이 없이 "/>" 으로 끝나는 경우이고, // AB_DoHaveSlash==false 이면 ">" 으로 끝나는 경우이다. return ZERunEx_OK; }/* template ZERunEx OnElementClose(TLoadXml&, bool AB_DoHaveSlash=false)*/ public: };/* template class ZtCViewLoadXml*/ namespace ZNsExam { template class ZtCViewLoadXml { public : typedef TStringData ZCStringData; public : typedef typename ZCStringData::TypeChar TypeChar ; typedef typename ZCStringData::TypeLength TypeLength ; typedef typename ZCStringData::TypeAlloc TypeAlloc ; typedef typename ZCStringData::ZCTypeChars ZCTypeChars ; typedef typename ZCStringData::ZCMainChars ZCMainChars ; typedef typename ZCStringData::ZCStringList ZCStringList; private: ZTypInt mi_Depth ; ZCStringData mo_CStringIndent ; // 들여쓰기 ZCStringData mo_CStringElement ; ZCStringList mo_ElementNameList; private: void SetCStringIndent() { mo_CStringIndent = ""; for(int i=0; i void InitExec(TLoadXml& AR_CLoadXml){} template void FiniExec(TLoadXml& AR_CLoadXml){} template ZERunEx OnError(TLoadXml& AR_CLoadXml, TypeChar AC_Char) { cout< ZERunEx OnError(TLoadXml& AR_CLoadXml, TypeChar AC_Char)*/ template ZERunEx OnNoHeader(TLoadXml& AR_CLoadXml){return ZERunEx_OK;} template ZERunEx OnHeaderStart(TLoadXml& AR_CLoadXml) { cout<<"★ Header Start ★"< ZERunEx OnHeaderBody(TLoadXml& AR_CLoadXml, const TypeChar* APC_Data, TypeLength AI_Length) { for(TypeLength i=0; i ZERunEx OnHeaderBody(TLoadXml& AR_CLoadXml, TypeChar AC_Char) { cout< ZERunEx OnHeaderClose(TLoadXml& AR_CLoadXml) { cout< ZERunEx OnHeaderClose(TLoadXml& AR_CLoadXml)*/ template ZERunEx OnNoDTD (TLoadXml&){return ZERunEx_OK;} template ZERunEx OnDTDStart (TLoadXml&) { cout<<"♧ DTD Start"; return ZERunEx_OK; } template ZERunEx OnDTDRootStart(TLoadXml&) { cout<<"(Root="; return ZERunEx_OK; } template ZERunEx OnDTDRootBody (TLoadXml&, const TypeChar* APC_Data, TypeLength AI_Length) { for(TypeLength i=0;i ZERunEx OnDTDRootClose (TLoadXml&) { cout<<")"< ZERunEx OnDTDBigStart (TLoadXml&) { cout<<" %% OnDTDBigStart"< ZERunEx OnDTDBigBody (TLoadXml&, const TypeChar* APC_Data, TypeLength AI_Length) { for(TypeLength i=0; i ZERunEx OnDTDBigClose (TLoadXml&) { cout< ZERunEx OnDTDSmallStart(TLoadXml&) { cout<<" %% OnDTDSmallStart"< ZERunEx OnDTDSmallBody (TLoadXml&, const TypeChar* APC_Data, TypeLength AI_Length) { for(TypeLength i=0; i ZERunEx OnDTDSmallClose(TLoadXml&) { cout< ZERunEx OnDTDClose (TLoadXml&) { cout<<"♧ DTD Close ♧ "< ZERunEx OnDTDClose (TLoadXml&)*/ template ZERunEx OnCommentStart(TLoadXml& AR_CLoadXml) { cout< ZERunEx OnCommentBody(TLoadXml& AR_CLoadXml, TypeChar AC_Char) { cout< ZERunEx OnCommentBody(TLoadXml& AR_CLoadXml, const TypeChar* APC_Data, TypeLength AI_Length) { for(TypeLength i=0; i ZERunEx OnCommentClose(TLoadXml& AR_CLoadXml) { cout< ZERunEx OnCommentClose(TLoadXml& AR_CLoadXml)*/ template ZERunEx OnElementStart(TLoadXml& AR_CLoadXml) { cout< ZERunEx OnElementNameStart(TLoadXml& AR_CLoadXml) { cout< ZERunEx OnElementNameBody(TLoadXml& AR_CLoadXml, const TypeChar* APC_Data, TypeLength AI_Length) { mo_CStringElement(APC_Data,AI_Length); for(TypeLength i=0; i ZERunEx OnElementNameClose(TLoadXml& AR_CLoadXml,int AI_Depth) { mi_Depth=AI_Depth; SetCStringIndent(); mo_ElementNameList.push_back(mo_CStringElement); mo_CStringElement=""; cout<<"\") OnElementNameClose(depth="< ZERunEx OnElementPropNameStart(TLoadXml& AR_CLoadXml) { cout< ZERunEx OnElementPropNameBody(TLoadXml& AR_CLoadXml, const TypeChar* APC_Data, TypeLength AI_Length) { for(TypeLength i=0; i ZERunEx OnElementPropNameClose(TLoadXml& AR_CLoadXml) { cout<<"\")"; return ZERunEx_OK; }/* template ZERunEx OnElementPropNameClose(TLoadXml& AR_CLoadXml)*/ template ZERunEx OnElementPropValueStart(TLoadXml& AR_CLoadXml) { cout<<" : Value=\""; return ZERunEx_OK; } template ZERunEx OnElementPropValueBody(TLoadXml& AR_CLoadXml, const TypeChar* APC_Data, TypeLength AI_Length) { for(TypeLength i=0; i ZERunEx OnElementPropValueClose(TLoadXml& AR_CLoadXml) { cout<<"\""< ZERunEx OnElementPropValueClose(TLoadXml& AR_CLoadXml)*/ template ZERunEx OnElementValueStart(TLoadXml& AR_CLoadXml) { cout< ZERunEx OnElementValueStart(TLoadXml& AR_CLoadXml)*/ /*//////////////////////////////////////////////////////////////////////////////////////////// ■ OnElementValueStart() 라는 함수가 있다면, OnElementValueClose() 라는 함수도 있는 있는 것이 좋겠지만, 이 역할을 OnElementClose() 가 하고 있기 때문에, OnElementValueClose() 함수는 정의하지 않는다. 즉 OnElementClose() 함수가 호출되면, 요소의 값도 끝난 것이 된다. -- 2011-09-25 22:29:00 ////////////////////////////////////////////////////////////////////////////////////////////*/ template ZERunEx OnElementName2Start(TLoadXml& AR_CLoadXml) // "" 형태에서 "요소명" 이 시작하는 경우. { cout< ZERunEx OnElementName2Body(TLoadXml& AR_CLoadXml, const TypeChar* APC_Data, TypeLength AI_Length) { mo_CStringElement(APC_Data,AI_Length); for(TypeLength i=0; i ZERunEx OnElementName2Close(TLoadXml& AR_CLoadXml) { if(mo_ElementNameList.size()<1) { cout< ZERunEx OnElementName2Close(TLoadXml& AR_CLoadXml)*/ /*///////////////////////////////////////////////////////////////////////////////////// ■ OnEleCDATA_Start(), OnEleCDATA_Close(), OnElePCDATA_Start(), OnElePCDATA_Close() 는 같은 요소에 대하여 1 회만 호출되어야 한다. 이 함수 내부에서 이 조건을 체크할 필요가 있다. -- 2011-09-20 03:25:00 /////////////////////////////////////////////////////////////////////////////////////*/ template ZERunEx OnEleCDATA_Start(TLoadXml& AR_CLoadXml) { cout< ZERunEx OnEleCDATA_Body(TLoadXml& AR_CLoadXml, const TypeChar* APC_Data, TypeLength AI_Length) { for(TypeLength i=0; i ZERunEx OnEleCDATA_Body (TLoadXml& AR_CLoadXml, TypeChar AC_Char) { cout< ZERunEx OnEleCDATA_Close(TLoadXml& AR_CLoadXml) { cout< ZERunEx OnEleCDATA_Close(TLoadXml& AR_CLoadXml)*/ template ZERunEx OnElePCDATA_Start(TLoadXml& AR_CLoadXml) { cout< ZERunEx OnElePCDATA_Body(TLoadXml& AR_CLoadXml, const TypeChar* APC_Data, TypeLength AI_Length) { for(TypeLength i=0; i ZERunEx OnElePCDATA_Body(TLoadXml& AR_CLoadXml, TypeChar AC_Char) { cout< ZERunEx OnElePCDATA_Close(TLoadXml& AR_CLoadXml) { cout< ZERunEx OnElePCDATA_Close(TLoadXml& AR_CLoadXml)*/ template ZERunEx OnElementClose(TLoadXml& AR_CLoadXml, bool AB_DoHaveSlash=false) { // AB_DoHaveSlash==true 이면 요소의 값이 없이 "/>" 으로 끝나는 경우이고, // AB_DoHaveSlash==false 이면 ">" 으로 끝나는 경우이다. --mi_Depth; SetCStringIndent(); cout< ZERunEx OnElementClose(TLoadXml& AR_CLoadXml, bool AB_DoHaveSlash=false)*/ public: };/* template class ZtCViewLoadXml*/ }/* namespace ZNsExam*/ }/* namespace ZNsViewIFace*/ namespace ZNsView { /*/////////////////////////////////////////////////////////// ■ TXmlInfo 가 가져야 하는 인터페이스 typedef typename ZCXmlInfo::ZCStringData ZCStringData ; typedef typename TXmlInfo ::ZCAttribute ZCAttribute ; typedef typename TXmlInfo ::ZCAttriList ZCAttriList ; typedef typename TXmlInfo ::ZCElement ZCElement ; typedef typename TXmlInfo ::ZCElementTree ZCElementTree ; typedef typename TXmlInfo ::ZCElementNode ZCElementNode ; typedef typename TXmlInfo ::ZCElementID ZCElementID ; typedef typename TXmlInfo ::ZCElementIDSet ZCElementIDSet ; typedef typename TXmlInfo ::ZCElementIDNode ZCElementIDNode; ZCElementIDSet& GetCElementIDSet() ZCElementTree& GetCElementTree () -- 2011-09-24 15:21:00 ///////////////////////////////////////////////////////////*/ template class ZtCViewLoadXmlOfXmlInfo { public : typedef TXmlInfo ZCXmlInfo ; typedef typename ZCXmlInfo::TypeData ZCTypeXmlInfo ; typedef typename ZCXmlInfo::ZCStringData ZCStringData ; typedef typename ZCXmlInfo::ZCAttribute ZCAttribute ; typedef typename ZCXmlInfo::ZCAttriList ZCAttriList ; typedef typename ZCXmlInfo::ZCElement ZCElement ; typedef typename ZCXmlInfo::ZCElementTree ZCElementTree ; typedef typename ZCXmlInfo::ZCElementNode ZCElementNode ; typedef typename ZCXmlInfo::ZCElementID ZCElementID ; typedef typename ZCXmlInfo::ZCElementIDSet ZCElementIDSet ; typedef typename ZCXmlInfo::ZCElementIDNode ZCElementIDNode ; public : typedef typename ZCStringData::TypeChar TypeChar ; typedef typename ZCStringData::TypeLength TypeLength ; typedef typename ZCStringData::TypeAlloc TypeAlloc ; typedef typename ZCStringData::ZCTypeChars ZCTypeChars ; typedef typename ZCStringData::ZCMainChars ZCMainChars ; public : typedef ZtCObjList ZCStringList ; private: ZTypInt mi_Depth ; ZCXmlInfo mo_CXmlInfo ; ZCElementNode* mp_CElementNode ; ZCAttribute* mp_CAttribute ; ZCStringList mo_ElementNameList; ZCStringData mo_CStringCloseEle; // " 형태에서의 "요소명". 시작 요소명과 일치해야 한다. ZCStringData mo_CStringErrorMSG; // " 형태에서의 "요소명". 시작 요소명과 일치해야 한다. public : ZtCViewLoadXmlOfXmlInfo() { mp_CElementNode=0; mp_CAttribute =0; mi_Depth =0; }/* ZtCViewLoadXmlOfXmlInfo()*/ ZTypInt GetDepth() const{return mi_Depth;} /***/ ZCXmlInfo& GetCXmlInfo() {return mo_CXmlInfo;} const ZCXmlInfo& GetCXmlInfo()const{return mo_CXmlInfo;} const ZCStringData& GetErrorMSG(){return mo_CStringErrorMSG;} void clear() { mi_Depth =0; mp_CElementNode =0; mp_CAttribute =0; mo_CXmlInfo .clear(); mo_ElementNameList.clear(); mo_CStringCloseEle.clear(); mo_CStringErrorMSG.clear(); }/* void clear()*/ /*public:*/ public: template void InitExec(TLoadXml& AR_CLoadXml){} template void FiniExec(TLoadXml& AR_CLoadXml){} template ZERunEx OnError(TLoadXml& AR_CLoadXml, TypeChar AC_Char){return ZERunEx_Err;} template ZERunEx OnNoHeader (TLoadXml&){return ZERunEx_OK;} template ZERunEx OnHeaderStart (TLoadXml&){return ZERunEx_OK;} template ZERunEx OnHeaderBody (TLoadXml&, const TypeChar* APC_Data, TypeLength AI_Length){return ZERunEx_OK;} template ZERunEx OnHeaderBody (TLoadXml&, TypeChar AC_Char){return ZERunEx_OK;} template ZERunEx OnHeaderClose (TLoadXml&){return ZERunEx_OK;} template ZERunEx OnNoDTD (TLoadXml&){return ZERunEx_OK;} template ZERunEx OnDTDStart (TLoadXml&){return ZERunEx_OK;} template ZERunEx OnDTDRootStart (TLoadXml&){return ZERunEx_OK;} template ZERunEx OnDTDRootBody (TLoadXml&, const TypeChar* APC_Data, TypeLength AI_Length){return ZERunEx_OK;} template ZERunEx OnDTDRootClose (TLoadXml&){return ZERunEx_OK;} template ZERunEx OnDTDBigStart (TLoadXml&){return ZERunEx_OK;} template ZERunEx OnDTDBigBody (TLoadXml&, const TypeChar* APC_Data, TypeLength AI_Length){return ZERunEx_OK;} template ZERunEx OnDTDBigClose (TLoadXml&){return ZERunEx_OK;} template ZERunEx OnDTDSmallStart(TLoadXml&){return ZERunEx_OK;} template ZERunEx OnDTDSmallBody (TLoadXml&, const TypeChar* APC_Data, TypeLength AI_Length){return ZERunEx_OK;} template ZERunEx OnDTDSmallClose(TLoadXml&){return ZERunEx_OK;} template ZERunEx OnDTDClose (TLoadXml&){return ZERunEx_OK;} template ZERunEx OnCommentStart(TLoadXml&){return ZERunEx_OK;} template ZERunEx OnCommentBody (TLoadXml&, TypeChar AC_Char){return ZERunEx_OK;} template ZERunEx OnCommentBody (TLoadXml&, const TypeChar* APC_Data, TypeLength AI_Length){return ZERunEx_OK;} template ZERunEx OnCommentClose(TLoadXml&){return ZERunEx_OK;} template ZERunEx OnElementStart (TLoadXml&) { /* 여기서 노드 포인터 mp_CElementNode 을 한 단계 내리고, OnElementClose() 에서 한 단계 올릴 것이다. */ if(mp_CElementNode==0) mp_CElementNode=&mo_CXmlInfo.GetCElementTree().GetRootNode(); else mp_CElementNode=&mp_CElementNode->AddSubNode(); return ZERunEx_OK; } template ZERunEx OnElementNameStart (TLoadXml&) { mo_CStringCloseEle.Invalid(); mp_CElementNode->GetData().GetName ().Invalid(); mp_CElementNode->GetData().GetContent().Invalid(); return ZERunEx_OK; } template ZERunEx OnElementNameBody (TLoadXml&, const TypeChar* APC_Data, TypeLength AI_Length) { mp_CElementNode->GetData().GetName()(APC_Data,AI_Length); return ZERunEx_OK; } template ZERunEx OnElementNameClose (TLoadXml&,int AI_Depth) { mp_CElementNode->GetData().SetDepth(AI_Depth); return ZERunEx_OK; } template ZERunEx OnElementPropNameStart (TLoadXml&) { mp_CAttribute=&mp_CElementNode->GetData().AddTailDefaultAttrib(); mp_CAttribute->GetName ().Invalid(); mp_CAttribute->GetValue().Invalid(); return ZERunEx_OK; } template ZERunEx OnElementPropNameBody (TLoadXml&, const TypeChar* APC_Data, TypeLength AI_Length) { mp_CAttribute->GetName()(APC_Data,AI_Length); return ZERunEx_OK; } template ZERunEx OnElementPropNameClose (TLoadXml&){return ZERunEx_OK;} template ZERunEx OnElementPropValueStart(TLoadXml&){return ZERunEx_OK;} template ZERunEx OnElementPropValueBody (TLoadXml&, const TypeChar* APC_Data, TypeLength AI_Length) { mp_CAttribute->GetValue()(APC_Data,AI_Length); return ZERunEx_OK; } template ZERunEx OnElementPropValueClose(TLoadXml&) { // id 라는 속성이 있으면, 모든 요소의 id 속성 중 유일한 값으로 간주해 따로 보관한다. mp_CAttribute->ConvertNormalValue(); // 속성의 값을 일반 문자열로 바꾼다. /*////////////////////////////////////////////////////////////////////////// 아래 if 문에서 mp_CAttribute->GetName()=="id" 처럼 한꺼번에 비교하지 않고, 'i' 와 'd' 을 따로 비교를 하고 있는데, 이것은 TypeChar 이 char 이 아닌 경우를 대비하기 위함이다. -- 2011-10-21 13:59:00 //////////////////////////////////////////////////////////////////////////*/ const int CI_LengthOfID = 2; // 속성명 "id" 의 길이. const bool CB_IsTrue = ( mp_CAttribute->GetName() .size() < CI_LengthOfID || mp_CAttribute->GetValue().size() < 1 || mp_CAttribute->GetName().data()[0]!=TypeChar('i') || mp_CAttribute->GetName().data()[1]!=TypeChar('d') ); //////////////////////////////////////////////////////////// if(CB_IsTrue) return ZERunEx_OK; ZCElementIDNode* VP_CElementIDNode = mo_CXmlInfo. GetCElementIDSet().AddKey( &mp_CAttribute->GetValue() ); if(VP_CElementIDNode==0) { #ifdef _DEBUG_SHOW_ cout<<"ID("<GetValue()<<") is Already!"<GetData().SetEleNodePtr(mp_CElementNode); //else return ZERunEx_OK; }/* template ZERunEx OnElementPropValueClose(TLoadXml&)*/ template ZERunEx OnElementValueStart(TLoadXml&){return ZERunEx_OK;} /*////////////////////////////////////////////////////////////////////////////////////////////// ■ OnElementValueStart() 라는 함수가 있다면, OnElementValueClose() 라는 함수도 있는 있는 것이 좋 겠지만, 이 역할을 OnElementClose() 가 하고 있기 때문에, OnElementValueClose() 함수는 정의하지 않는다. 즉 OnElementClose() 함수가 호출되면, 요소의 값도 끝난 것이 된다. -- 2011-09-25 22:29:00 ■ OnElementName2~() 계열의 함수는 요소의 끝 부분이 "" 형태로 되어있는 부분에서 "요소명" 부분을 처리한다. 따라서 이 "요소명"이 OnElementNameClose() 에서 알아낸 "요소명", 즉 요소의 처음 부분에서 지정된 "요소명"과 같은 지 체크해서, 다르면 에러 처리를 한다. -- 2011-10-22 10:26:00 //////////////////////////////////////////////////////////////////////////////////////////////*/ template ZERunEx OnElementName2Start(TLoadXml&){return ZERunEx_OK;} // "" 형태에서 "요소명" 이 시작하는 경우. template ZERunEx OnElementName2Body (TLoadXml&, const TypeChar* APC_Data, TypeLength AI_Length) { mo_CStringCloseEle(APC_Data, AI_Length); return ZERunEx_OK; } template ZERunEx OnElementName2Close(TLoadXml&) { if(mp_CElementNode->GetData().GetName()!=mo_CStringCloseEle) { (mo_CStringErrorMSG="Element Names is Different. " "Starting Element Name is '")(mp_CElementNode->GetData().GetName())("', " "Closing Element Name is '" )(mo_CStringCloseEle )("'"); return ZERunEx_Err; } else return ZERunEx_OK ; //else }/* template ZERunEx OnElementName2Close(TLoadXml&)*/ /*///////////////////////////////////////////////////////////////////////////////////// ■ OnEleCDATA_Start(), OnEleCDATA_Close(), OnElePCDATA_Start(), OnElePCDATA_Close() 는 같은 요소에 대하여 1 회만 호출되어야 한다. 이 함수 내부에서 이 조건을 체크할 필요가 있다. -- 2011-09-20 03:25:00 /////////////////////////////////////////////////////////////////////////////////////*/ template ZERunEx OnEleCDATA_Start(TLoadXml&) { /* 같은 요소에 대하여 중복 호출을 체크한다. 즉 이미 요소의 값이 설정되어 있으면, 이전에 이미 호출된 것이라, 더 이상 수행되어서는 안된다. */ if(mp_CElementNode->GetData().GetContent().size()>0) { (mo_CStringErrorMSG = "Content of the Element '") (mp_CElementNode->GetData().GetName()) ("' Is Already Exists : In OnEleCDATA_Start()"); return ZERunEx_Err; } else return ZERunEx_OK ; //else } template ZERunEx OnEleCDATA_Body (TLoadXml&, const TypeChar* APC_Data, TypeLength AI_Length) { mp_CElementNode->GetData().GetContent()(APC_Data,AI_Length); return ZERunEx_OK; } template ZERunEx OnEleCDATA_Body (TLoadXml&, TypeChar AC_Char) { mp_CElementNode->GetData().GetContent()(AC_Char); return ZERunEx_OK; } template ZERunEx OnEleCDATA_Close(TLoadXml&){return ZERunEx_OK;/*같은 요소에 대하여 중복 호출 체크*/} template ZERunEx OnElePCDATA_Start(TLoadXml&) { /* 같은 요소에 대하여 중복 호출을 체크한다. 즉 이미 요소의 값이 설정되어 있으면 수행되어서는 안된다. */ if(mp_CElementNode->GetData().GetContent().size()>0) { (mo_CStringErrorMSG= "Content of the Element '") (mp_CElementNode->GetData().GetName()) ("' Is Already Exists : In OnElePCDATA_Start()"); return ZERunEx_Err; } else return ZERunEx_OK ; //else } template ZERunEx OnElePCDATA_Body (TLoadXml&, const TypeChar* APC_Data, TypeLength AI_Length) { mp_CElementNode->GetData().GetContent()(APC_Data,AI_Length); return ZERunEx_OK; } template ZERunEx OnElePCDATA_Body (TLoadXml&, TypeChar AC_Char) { mp_CElementNode->GetData().GetContent()(AC_Char); return ZERunEx_OK; } template ZERunEx OnElePCDATA_Close(TLoadXml&) { // 같은 요소에 대하여 중복 호출 체크가 필요. mp_CElementNode->GetData().ConvertNormalContent(); return ZERunEx_OK; }/* template ZERunEx OnElePCDATA_Close(TLoadXml&)*/ template ZERunEx OnElementClose(TLoadXml&, bool AB_DoHaveSlash=false) { // AB_DoHaveSlash==true 이면 요소의 값이 없이 "/>" 으로 끝나는 경우이고, // AB_DoHaveSlash==false 이면 ">" 으로 끝나는 경우이다. // 노드 포인터 mp_CElementNode 을 한 단계 위로 올린다. mo_CStringCloseEle.Invalid(); mp_CElementNode = mp_CElementNode->GetHighNodePtr(); return ZERunEx_OK; }/* template ZERunEx OnElementClose(TLoadXml&, bool AB_DoHaveSlash=false)*/ public: };/* template class ZtCViewLoadXmlOfXmlInfo */ }/* namespace ZNsView*/ /*//////////////////////////////////////////////////////// ■ Searching 문자 테이블(Searching Letter Table) □ 헤더 1 2 3 4 5 6 7 8 1 Skp ☞ (1,1 ) 2 < ! - - 주 ☞ (5,2 ) 3 - - > ☞ (1,1 ) 4 ? 헤 ☞ (3,3 ) 5 ? > ☞ (1,21) □ 요소 시작 부분 1 2 3 4 5 6 7 8 9 21 Skp ☞ (1,21) 22 < ! - - 주 ☞ (5,22) 23 - - > ☞ (1,21) 24 요 요 ☞ (3,24) 25 / > ☞ (1,21) 26 > ☞ (1,41) 27 Skp Skp ☞ (4,27) 28 / > ☞ (1,21) 29 > ☞ (1,41) 30 속 속 ☞ (5,30) 31 = Skp ☞ (6,31) 32 " 속값 ☞ (7,32) 33 " Skp ☞ (8,33) 34 / > ☞ (1,21) 35 > ☞ (1,41) 36 / > ☞ (1,21) 37 > ☞ (1,41) 38 Skp Skp ☞ (6,38) 39 = ☞ (6,31) 3A / > ☞ (1,21) 3B > ☞ (1,41) 3C / 요 요 ☞ (4,3C) 3D > ☞ (1,21) □ 요소 값 부분 1 2 3 4 5 6 7 8 9 10 11 12 41 Skp ☞ (1,41) 42 < ! - - 주 ☞ (5.42) 43 - - > ☞ (1.41) 44 [ C D A T A [ CD ☞ (10,44) 45 ] ] > ☞ (1,61) 46 요 ☞ (3,24) 47 / ☞ (4,3C) 48 요 요 ☞ (4,48) 49 > ☞ (1,21) 50 PCD ☞ (1,51) □ PCDATA 1 2 3 4 5 6 7 8 51 PCD ☞ (1,51) 52 < ! - - 주 ☞ (5.52) 53 - - > ☞ (1.51) 54 / 요 요 ☞ (4.54) 55 > ☞ (1,21) □ 요소 닫는 부분 1 2 3 4 5 6 7 8 61 Skp ☞ (1,61) 62 < ! - - 주 ☞ (5,62) 63 - - > ☞ (1,61) 64 / 요 요 ☞ (4,64) 65 > ☞ (1,21) 65 요 ☞ (3,24) ////////////////////////////////////////////////////////*/ template< typename TStringData=ZNsMain::ZtCStringBase > class ZtCLoadXml //////////////////////////////////////////// { public: typedef TStringData ZCStringData; public: typedef typename ZCStringData::TypeChar TypeChar ; typedef typename ZCStringData::TypeLength TypeLength ; typedef typename ZCStringData::TypeAlloc TypeAlloc ; typedef typename ZCStringData::ZCTypeChars ZCTypeChars ; typedef typename ZCStringData::ZCMainChars ZCMainChars ; typedef typename ZCStringData::ZCStringList ZCStringList; public: enum EWaitByte { EWaitByte_HeadStart , // < EWaitByte_HeadCommExclaMark , // EWaitByte_HeadValue , // EWaitByte_DTDStart , // < EWaitByte_DTDCommExclaMark , // EWaitByte_DTDDocTypeDO , // EWaitByte_DTDBodySmall , //" EWaitByte_EleName , // <요소명 EWaitByte_EleClose , // <요소명/> EWaitByte_EleNameSkip , //"<요소명 " EWaitByte_EleNameSkipClose , // <요소명 /> EWaitByte_EleNameSkipEnd , // <요소명 > EWaitByte_EleNameSkipProp , // <요소명 속성명 EWaitByte_EleNameSkipProp2 , // <요소명 속성명 + Skp + Skp EWaitByte_EleNameSkipPropQuote , // <요소명 속성명=" EWaitByte_EleNameSkipPropValue , // <요소명 속성명="속성값 EWaitByte_EleNameSkipPropValue2 , // <요소명 속성명="속성값" + Skp EWaitByte_EleNameSkipPropClose , // <요소명 속성명="속성값" /> EWaitByte_EleCloseComplete , // EWaitByte_EleValStart , // < EWaitByte_EleValCommExclaMark , // EWaitByte_EleValCDataC , // EWaitByte_EleValCloseName1 , // EWaitByte_EleValPCData , // PCDATA EWaitByte_EleValPCDataCommExcla , // EWaitByte_EleValPCDataCloseEle , // EWaitByte_EleCloseOpen , // < EWaitByte_EleCloseCommExclaMark , // EWaitByte_EleCloseName , // };/* enum EWaitByte*/ /*public :*/ protected: EWaitByte me_EWaitByte; ZTypInt mi_EleDepth ; // 요소의 깊이. ZTypInt mi_NowLineNo; // 현재 처리하고 있는 라인 번호. ZTypInt mi_NowCharNo; // 현재 라인에서 처리하고 있는 문자 번호. ZTypInt mi_NowXmlPos; // 현재 처리하고 있는, 원본 문자열의 문자 위치. ZTypInt mi_SumXmlPos; // mi_NowXmlPos 의 누적값. protected: bool IsSkipChar(TypeChar AC_TypeChar) { switch(AC_TypeChar) { case TypeChar(' ') : case TypeChar('\r'): case TypeChar('\n'): case TypeChar('\t'): return true; }/* switch(AC_TypeChar)*/ return false; }/* bool IsSkipChar(TypeChar AC_TypeChar)*/ bool IsEleNameChar(TypeChar AC_TypeChar) { /*/////////////////////////////////////////////////////////////////////// 아래는 숫자와 알파벳, '-', '_' 만 허용했던 경우의 코드. if(AC_TypeChar>=TypeChar('0') && AC_TypeChar<=TypeChar('9')) return true; if(AC_TypeChar>=TypeChar('a') && AC_TypeChar<=TypeChar('z')) return true; if(AC_TypeChar>=TypeChar('A') && AC_TypeChar<=TypeChar('Z')) return true; if(AC_TypeChar==TypeChar('-') || AC_TypeChar==TypeChar('_')) return true; return false; 위 코드를 아래로 바꾸어, 한글 요소명을 허용한다. -- 2011-10-06 20:15:00 ///////////////////////////////////////////////////////////////////////*/ switch(AC_TypeChar) { case TypeChar(' ' ): case TypeChar('\t'): case TypeChar('\r'): case TypeChar('\n'): case TypeChar('!' ): case TypeChar('@' ): case TypeChar('#' ): case TypeChar('$' ): case TypeChar('%' ): case TypeChar('^' ): case TypeChar('&' ): case TypeChar('*' ): case TypeChar('(' ): case TypeChar(')' ): case TypeChar('+' ): case TypeChar('=' ): case TypeChar('?' ): case TypeChar('<' ): case TypeChar('>' ): case TypeChar('~' ): case TypeChar('`' ): case TypeChar('.' ): case TypeChar('/' ): case TypeChar('\\'): case TypeChar('[' ): case TypeChar(']' ): case TypeChar('{' ): case TypeChar('}' ): case TypeChar(':' ): case TypeChar(';' ): case TypeChar('\''): case TypeChar('\"'): return false; }/* switch(AC_TypeChar)*/ return true; }/* bool IsEleNameChar(TypeChar AC_TypeChar)*/ bool IsPropNameChar(TypeChar AC_TypeChar) { /*/////////////////////////////////////////////////////////////////////// 아래는 숫자와 알파벳, '-', '_' 만 허용했던 경우의 코드. if(AC_TypeChar>=TypeChar('0') && AC_TypeChar<=TypeChar('9')) return true; if(AC_TypeChar>=TypeChar('a') && AC_TypeChar<=TypeChar('z')) return true; if(AC_TypeChar>=TypeChar('A') && AC_TypeChar<=TypeChar('Z')) return true; if(AC_TypeChar==TypeChar('-') || AC_TypeChar==TypeChar('_')) return true; return false; 위 코드를 아래로 바꾸어, 한글 속성명을 허용한다. -- 2011-10-06 20:27:00 ///////////////////////////////////////////////////////////////////////*/ switch(AC_TypeChar) { case TypeChar(' ' ): case TypeChar('\t'): case TypeChar('\r'): case TypeChar('\n'): case TypeChar('!' ): case TypeChar('@' ): case TypeChar('#' ): case TypeChar('$' ): case TypeChar('%' ): case TypeChar('^' ): case TypeChar('&' ): case TypeChar('*' ): case TypeChar('(' ): case TypeChar(')' ): case TypeChar('+' ): case TypeChar('=' ): case TypeChar('?' ): case TypeChar('<' ): case TypeChar('>' ): case TypeChar('~' ): case TypeChar('`' ): case TypeChar('.' ): case TypeChar('/' ): case TypeChar('\\'): case TypeChar('[' ): case TypeChar(']' ): case TypeChar('{' ): case TypeChar('}' ): case TypeChar(':' ): case TypeChar(';' ): case TypeChar('\''): case TypeChar('\"'): return false; }/* switch(AC_TypeChar)*/ return true; }/* bool IsPropNameChar(TypeChar AC_TypeChar)*/ bool IsPropValueChar(TypeChar AC_TypeChar) { return (AC_TypeChar!=TypeChar('"') && AC_TypeChar!=TypeChar('\n')); } bool IsPCDATA (TypeChar AC_TypeChar) { return (AC_TypeChar!=TypeChar('>') && AC_TypeChar!=TypeChar('<' )); } /*protected:*/ public : ZtCLoadXml() { me_EWaitByte=EWaitByte_HeadStart; mi_NowLineNo=1; mi_NowCharNo=1; mi_NowXmlPos=0; mi_SumXmlPos=0; mi_EleDepth =0; }/* ZtCLoadXml()*/ void clear() { me_EWaitByte=EWaitByte_HeadStart; mi_EleDepth =0; mi_NowXmlPos=0; mi_SumXmlPos=0; mi_NowLineNo=1; mi_NowCharNo=1; }/* void clear()*/ ZTypInt GetLineNo () const{return mi_NowLineNo;} ZTypInt GetCharNo () const{return mi_NowCharNo;} ZTypInt GetXmlPos () const{return mi_NowXmlPos;} ZTypInt GetSumXmlPos () const{return mi_SumXmlPos;} ZTypInt GetElementDepth() const{return mi_EleDepth ;} EWaitByte GetEWaitByte () const{return me_EWaitByte;} const char* GetMSG_EWaitByte(int AE_EWaitByte) const { switch(AE_EWaitByte) { case EWaitByte_HeadStart : return "EWaitByte_HeadStart" ; case EWaitByte_HeadCommExclaMark : return "EWaitByte_HeadCommExclaMark" ; case EWaitByte_HeadCommHyphen : return "EWaitByte_HeadCommHyphen" ; case EWaitByte_HeadCommHyphen2 : return "EWaitByte_HeadCommHyphen2" ; case EWaitByte_HeadCommValue : return "EWaitByte_HeadCommValue" ; case EWaitByte_HeadComm2Hyphen2 : return "EWaitByte_HeadComm2Hyphen2" ; case EWaitByte_HeadCommEnd : return "EWaitByte_HeadCommEnd" ; case EWaitByte_HeadValue : return "EWaitByte_HeadValue" ; case EWaitByte_HeadEnd : return "EWaitByte_HeadEnd" ; case EWaitByte_DTDStart : return "EWaitByte_DTDStart" ; case EWaitByte_DTDCommExclaMark : return "EWaitByte_DTDCommExclaMark" ; case EWaitByte_DTDCommHyphen : return "EWaitByte_DTDCommHyphen" ; case EWaitByte_DTDCommHyphen2 : return "EWaitByte_DTDCommHyphen2" ; case EWaitByte_DTDCommValue : return "EWaitByte_DTDCommValue" ; case EWaitByte_DTDComm2Hyphen2 : return "EWaitByte_DTDComm2Hyphen2" ; case EWaitByte_DTDCommEnd : return "EWaitByte_DTDCommEnd" ; case EWaitByte_DTDDocTypeDO : return "EWaitByte_DTDDocTypeDO" ; case EWaitByte_DTDDocTypeDOC : return "EWaitByte_DTDDocTypeDOC" ; case EWaitByte_DTDDocTypeDOCT : return "EWaitByte_DTDDocTypeDOCT" ; case EWaitByte_DTDDocTypeDOCTY : return "EWaitByte_DTDDocTypeDOCTY" ; case EWaitByte_DTDDocTypeDOCTYP : return "EWaitByte_DTDDocTypeDOCTYP" ; case EWaitByte_DTDDocTypeDOCTYPE : return "EWaitByte_DTDDocTypeDOCTYPEf" ; case EWaitByte_DTDDocTypeSkip : return "EWaitByte_DTDDocTypeSkipf" ; case EWaitByte_DTDDocTypeSkip2 : return "EWaitByte_DTDDocTypeSkip2" ; case EWaitByte_DTDDocTypeRoot2 : return "EWaitByte_DTDDocTypeRoot2" ; case EWaitByte_DTDDocTypeRoot2Skip : return "EWaitByte_DTDDocTypeRoot2Skip" ; case EWaitByte_DTDBody : return "EWaitByte_DTDBody" ; case EWaitByte_DTDClose : return "EWaitByte_DTDClose" ; case EWaitByte_DTDBodySmall : return "EWaitByte_DTDBodySmall" ; case EWaitByte_EleStart : return "EWaitByte_EleStart" ; case EWaitByte_EleCommExclaMark : return "EWaitByte_EleCommExclaMark" ; case EWaitByte_EleCommHyphen : return "EWaitByte_EleCommHyphen" ; case EWaitByte_EleCommHyphen2 : return "EWaitByte_EleCommHyphen2" ; case EWaitByte_EleCommValue : return "EWaitByte_EleCommValue" ; case EWaitByte_EleComm2Hyphen2 : return "EWaitByte_EleComm2Hyphen2" ; case EWaitByte_EleCommEnd : return "EWaitByte_EleCommEnd" ; case EWaitByte_EleName : return "EWaitByte_EleName" ; case EWaitByte_EleClose : return "EWaitByte_EleClose" ; case EWaitByte_EleNameSkip : return "EWaitByte_EleNameSkip" ; case EWaitByte_EleNameSkipClose : return "EWaitByte_EleNameSkipClose" ; case EWaitByte_EleNameSkipEnd : return "EWaitByte_EleNameSkipEnd" ; case EWaitByte_EleNameSkipProp : return "EWaitByte_EleNameSkipProp" ; case EWaitByte_EleNameSkipProp2 : return "EWaitByte_EleNameSkipProp2" ; case EWaitByte_EleNameSkipPropQuote : return "EWaitByte_EleNameSkipPropQuote" ; case EWaitByte_EleNameSkipPropValue : return "EWaitByte_EleNameSkipPropValue" ; case EWaitByte_EleNameSkipPropValue2 : return "EWaitByte_EleNameSkipPropValue2" ; case EWaitByte_EleNameSkipPropClose : return "EWaitByte_EleNameSkipPropClose" ; case EWaitByte_EleCloseComplete : return "EWaitByte_EleCloseComplete" ; case EWaitByte_EleCloseComplete2 : return "EWaitByte_EleCloseComplete2" ; case EWaitByte_EleValStart : return "EWaitByte_EleValStart" ; case EWaitByte_EleValCommExclaMark : return "EWaitByte_EleValCommExclaMark" ; case EWaitByte_EleValCommHyphen : return "EWaitByte_EleValCommHyphen" ; case EWaitByte_EleValCommHyphen2 : return "EWaitByte_EleValCommHyphen2" ; case EWaitByte_EleValCommValue : return "EWaitByte_EleValCommValue" ; case EWaitByte_EleValComm2Hyphen2 : return "EWaitByte_EleValComm2Hyphen2" ; case EWaitByte_EleValCommEnd : return "EWaitByte_EleValCommEnd" ; case EWaitByte_EleValCDataC : return "EWaitByte_EleValCDataC" ; case EWaitByte_EleValCDataCD : return "EWaitByte_EleValCDataCD" ; case EWaitByte_EleValCDataCDA : return "EWaitByte_EleValCDataCDA" ; case EWaitByte_EleValCDataCDAT : return "EWaitByte_EleValCDataCDAT" ; case EWaitByte_EleValCDataCDATA : return "EWaitByte_EleValCDataCDATA" ; case EWaitByte_EleValCDataSquBracket2 : return "EWaitByte_EleValCDataSquBracket2" ; case EWaitByte_EleValCDataContent : return "EWaitByte_EleValCDataContent" ; case EWaitByte_EleValCDataClose2 : return "EWaitByte_EleValCDataClose2" ; case EWaitByte_EleValCDataClose3 : return "EWaitByte_EleValCDataClose3" ; case EWaitByte_EleValCloseName1 : return "EWaitByte_EleValCloseName1" ; case EWaitByte_EleValCloseName2 : return "EWaitByte_EleValCloseName2" ; case EWaitByte_EleValPCData : return "EWaitByte_EleValPCData" ; case EWaitByte_EleValPCDataCommExcla : return "EWaitByte_EleValPCDataCommExcla" ; case EWaitByte_EleValPCDataCommHypen : return "EWaitByte_EleValPCDataCommHypen" ; case EWaitByte_EleValPCDataCommHypen2 : return "EWaitByte_EleValPCDataCommHypen2" ; case EWaitByte_EleValPCDataCommValue : return "EWaitByte_EleValPCDataCommValue" ; case EWaitByte_EleValPCDataComm2Hypen2: return "EWaitByte_EleValPCDataComm2Hypen2"; case EWaitByte_EleValPCDataCommEnd : return "EWaitByte_EleValPCDataCommEnd" ; case EWaitByte_EleValPCDataCloseEle : return "EWaitByte_EleValPCDataCloseEle" ; case EWaitByte_EleValPCDataCloseEle2 : return "EWaitByte_EleValPCDataCloseEle2" ; case EWaitByte_EleCloseOpen : return "EWaitByte_EleCloseOpen" ; case EWaitByte_EleCloseCommExclaMark : return "EWaitByte_EleCloseCommExclaMark" ; case EWaitByte_EleCloseCommHyphen : return "EWaitByte_EleCloseCommHyphen" ; case EWaitByte_EleCloseCommHyphen2 : return "EWaitByte_EleCloseCommHyphen2" ; case EWaitByte_EleCloseCommValue : return "EWaitByte_EleCloseCommValue" ; case EWaitByte_EleCloseComm2Hyphen2 : return "EWaitByte_EleCloseComm2Hyphen2" ; case EWaitByte_EleCloseCommEnd : return "EWaitByte_EleCloseCommEnd" ; case EWaitByte_EleCloseName : return "EWaitByte_EleCloseName" ; case EWaitByte_EleCloseName2 : return "EWaitByte_EleCloseName2" ; }/* switch(AE_EWaitByte)*/ return ""; }/* const char* GetMSG_EWaitByte(int AE_EWaitByte) const*/ const char* GetMSG_EWaitByte() const { return GetMSG_EWaitByte(me_EWaitByte); }/* const char* GetMSG_EWaitByte() const*/ template ZERunEx Exec /*################################*/ ( TViewLoadXml& AR_CViewLoadXml , const TypeChar* APC_XmlData , TypeLength AI_DataLen ) /*#############################################################################*/ { class ZCInitFiniOfView //@@@@@@@@@@@@@@@@@@@@@@@ { private: ZtCLoadXml& mr_CLoadXml ; TViewLoadXml& mr_CViewLoadXml; public : ZCInitFiniOfView(ZtCLoadXml& AR_CLoadXml, TViewLoadXml& AR_CViewLoadXml) : mr_CLoadXml (AR_CLoadXml ), mr_CViewLoadXml(AR_CViewLoadXml) {mr_CViewLoadXml.InitExec(mr_CLoadXml);} ~ZCInitFiniOfView(){mr_CViewLoadXml.FiniExec(mr_CLoadXml);} public : };/* class ZCInitFiniOfView*/ //@@@@@@@@@@@@@@@@@@@@@@@ ZERunEx VE_ERunEx = ZERunEx_OK ; const TypeChar* VPC_XmlData= APC_XmlData; if(AI_DataLen<1) return ZERunEx_OK; mi_NowXmlPos = 0; // VPC_XmlData 의 위치. ZCInitFiniOfView VO_CInitFiniOfView(*this, AR_CViewLoadXml); /**/ TypeLength VI_BuffLen=0; // VPC_Buff 의 길이 const TypeChar* VPC_Buff =0; switch(me_EWaitByte) { /*///////////////////////////////////////////////////////// ■ 주석, 요소 이름, 속성 이름을 처리 중이었던 경우에는 VPC_Buff=APC_XmlData; 을 수행하여, 같은 데이타가 올 경우에 바로 처리하게 한다. /////////////////////////////////////////////////////////*/ case EWaitByte_HeadCommValue : // 좌표 (5,2) ☞ "" else { if((VE_ERunEx=AR_CViewLoadXml. OnCommentBody(*this, TypeChar('-')))!=ZERunEx_OK) return VE_ERunEx; /*<<<<<<<<<<<<<<<<<<<<<<<<<<*/ me_EWaitByte= EWaitByte_HeadCommValue ; VPC_Buff = VPC_XmlData; VI_BuffLen=1; // *VPC_XmlData 이 주석으로 들어간다. } //else } //else if(me_EWaitByte==EWaitByte_HeadComm2Hyphen2) // 좌표 (6,3) ☞ "" { if(*VPC_XmlData==TypeChar('>')) { me_EWaitByte=EWaitByte_HeadStart; if((VE_ERunEx=AR_CViewLoadXml. OnCommentClose(*this))!=ZERunEx_OK) return VE_ERunEx; /*<<<<<<<<<<<<<<<<<<<<<<<<<<*/ } else if(*VPC_XmlData==TypeChar('-')) { // "---" 형태인 경우. 앞에 한 글자를 주석으로 처리한다. if((VE_ERunEx=AR_CViewLoadXml. OnCommentBody(*this, TypeChar('-')))!=ZERunEx_OK) return VE_ERunEx; /*<<<<<<<<<<<<<<<<<<<<<<<<<<*/ } else { /*///////////////////////////////////////////////////////////////////////////// ■ "-->" 와 마지막 글자만 다른 경우, 3 글자 모두 주석으로 처리한다. "--" 2 글자를 먼저 처리하고, 나머지 1 바이트 *VPC_XmlData 을 VPC_Buff 에 지정한다. ■ 이전에는 AR_CViewLoadXml.OnCommentBody("--",2) 을 사용했으나, TypeChar 이 wchar_t 나 기타 자료인 경우, View 클래스나 상속 클래스 등에서 정의하기가 까다로워서 AR_CViewLoadXml.OnCommentBody(TypeChar('-')) 을 2회 호출하는 것으로 한다. -- 2011-09-24 22:58:00 /////////////////////////////////////////////////////////////////////////////*/ if((VE_ERunEx=AR_CViewLoadXml.OnCommentBody(*this, TypeChar('-')))!=ZERunEx_OK) return VE_ERunEx; if((VE_ERunEx=AR_CViewLoadXml.OnCommentBody(*this, TypeChar('-')))!=ZERunEx_OK) return VE_ERunEx; me_EWaitByte= EWaitByte_HeadCommValue; VPC_Buff = VPC_XmlData; VI_BuffLen=1; // 마지막 글자를 주석으로 지정하는 코드. } //else } //else if(me_EWaitByte==EWaitByte_HeadCommEnd) // 좌표 (7,3) ☞ "" else if(me_EWaitByte==EWaitByte_HeadValue) // 좌표 (5,2) ☞ "" else { if((VE_ERunEx=AR_CViewLoadXml. OnCommentBody(*this, TypeChar('-')))!=ZERunEx_OK) return VE_ERunEx; /*<<<<<<<<<<<<<<<<<<<<<<<<<<*/ me_EWaitByte= EWaitByte_DTDCommValue; VPC_Buff = VPC_XmlData; VI_BuffLen=1; // *VPC_XmlData 이 주석으로 들어간다. } //else } //else if(me_EWaitByte==EWaitByte_DTDComm2Hyphen2) // 좌표 (6,10) ☞ "" { if(*VPC_XmlData==TypeChar('>')) { if((VE_ERunEx=AR_CViewLoadXml. OnCommentClose(*this))!=ZERunEx_OK) return VE_ERunEx; /*<<<<<<<<<<<<<<<<<<<<<<<<<<*/ me_EWaitByte=EWaitByte_DTDStart; } else if(*VPC_XmlData==TypeChar('-')) { // "---" 형태인 경우. 앞에 한 글자를 주석으로 처리한다. if((VE_ERunEx=AR_CViewLoadXml. OnCommentBody(*this, TypeChar('-')))!=ZERunEx_OK) return VE_ERunEx; /*<<<<<<<<<<<<<<<<<<<<<<<<<<*/ } else { /*///////////////////////////////////////////////////////////////////////////// ■ "-->" 와 마지막 글자만 다른 경우, 3 글자 모두 주석으로 처리한다. "--" 2 글자를 먼저 처리하고, 나머지 1 바이트 *VPC_XmlData 을 VPC_Buff 에 지정한다. ■ 이전에는 AR_CViewLoadXml.OnCommentBody("--",2) 을 사용했으나, TypeChar 이 wchar_t 나 기타 자료인 경우, View 클래스나 상속 클래스 등에서 정의하기가 까다로워서 AR_CViewLoadXml.OnCommentBody(TypeChar('-')) 을 2회 호출하는 것으로 한다. -- 2011-09-24 22:58:00 /////////////////////////////////////////////////////////////////////////////*/ if((VE_ERunEx=AR_CViewLoadXml.OnCommentBody(*this, TypeChar('-')))!=ZERunEx_OK) return VE_ERunEx; if((VE_ERunEx=AR_CViewLoadXml.OnCommentBody(*this, TypeChar('-')))!=ZERunEx_OK) return VE_ERunEx; me_EWaitByte= EWaitByte_DTDCommValue ; VPC_Buff = VPC_XmlData; VI_BuffLen=1; // 마지막 글자를 주석으로 지정하는 코드. } //else } //else if(me_EWaitByte==EWaitByte_DTDCommEnd) // 좌표 (7,10) ☞ "" else if(me_EWaitByte==EWaitByte_DTDDocTypeDO) // 좌표 (4,11) ☞ "" { if(*VPC_XmlData==TypeChar('>')) { if((VE_ERunEx=AR_CViewLoadXml. OnDTDClose(*this))!=ZERunEx_OK) return VE_ERunEx; /*<<<<<<<<<<<<<<<<<<<<<<<<<<*/ me_EWaitByte=EWaitByte_EleStart; // 좌표 (1,21) ☞ "<" } else return AR_CViewLoadXml.OnError(*this, *VPC_XmlData); //else } //else if(me_EWaitByte==EWaitByte_DTDClose) // 좌표 (15,15) ☞ "]" else if(me_EWaitByte==EWaitByte_DTDBodySmall) // 좌표 (14,16) ☞ "')) { if((VE_ERunEx=AR_CViewLoadXml.OnDTDSmallBody (*this, VPC_Buff, VI_BuffLen))!=ZERunEx_OK) return VE_ERunEx; if((VE_ERunEx=AR_CViewLoadXml.OnDTDSmallClose(*this ))!=ZERunEx_OK) return VE_ERunEx; if((VE_ERunEx=AR_CViewLoadXml.OnDTDClose (*this ))!=ZERunEx_OK) return VE_ERunEx; VPC_Buff = 0; VI_BuffLen=0 ; me_EWaitByte= EWaitByte_EleStart; // 좌표 (1,21) ☞ "<" } else if(*VPC_XmlData==TypeChar('[') || *VPC_XmlData==TypeChar(']') || *VPC_XmlData==TypeChar('<')) { // 이 이외의 경우에도 에러일 수 있지만, 그런 세세한 에러는 View object 즉 AR_CViewLoadXml 에서 판단하도록 한자. return AR_CViewLoadXml.OnError(*this, *VPC_XmlData); } else ++VI_BuffLen; //else } //else if(me_EWaitByte==EWaitByte_DTDBodySmall) // 좌표 (14,16) ☞ " else { if((VE_ERunEx=AR_CViewLoadXml.OnCommentBody( *this, TypeChar('-')))!=ZERunEx_OK) return VE_ERunEx; me_EWaitByte= EWaitByte_EleCommValue ; VPC_Buff = VPC_XmlData; VI_BuffLen=1; // *VPC_XmlData 이 주석으로 들어간다. }/* else*/ } //else if(me_EWaitByte==EWaitByte_EleComm2Hyphen2) // " 와 마지막 글자만 다른 경우, 3 글자 모두 주석으로 처리한다. // 먼저 "--" 부터 처리하고, *VPC_XmlData 은 VPC_Buff 에 담는다. if((VE_ERunEx=AR_CViewLoadXml.OnCommentBody(*this, TypeChar('-')))!=ZERunEx_OK) return VE_ERunEx; if((VE_ERunEx=AR_CViewLoadXml.OnCommentBody(*this, TypeChar('-')))!=ZERunEx_OK) return VE_ERunEx; me_EWaitByte=EWaitByte_EleCommValue ; VPC_Buff =VPC_XmlData; VI_BuffLen=1; // *VPC_XmlData 은 VPC_Buff 에 담는다. }/* else*/ } //else if(me_EWaitByte==EWaitByte_EleCommEnd) else if(me_EWaitByte==EWaitByte_EleName) // ☞ 좌표 (3,24) "<요요" { bool VB_IsSkipChar=IsSkipChar(*VPC_XmlData); if(IsEleNameChar(*VPC_XmlData)) ++VI_BuffLen; else if(*VPC_XmlData==TypeChar('/') || *VPC_XmlData==TypeChar('>') || VB_IsSkipChar) { // 논리의 흐름상, VI_BuffLen>=1 이다. if((VE_ERunEx=AR_CViewLoadXml.OnElementNameBody (*this, VPC_Buff, VI_BuffLen))!=ZERunEx_OK) return VE_ERunEx; if((VE_ERunEx=AR_CViewLoadXml.OnElementNameClose(*this, ++mi_EleDepth ))!=ZERunEx_OK) return VE_ERunEx; VPC_Buff=0; VI_BuffLen=0; if (*VPC_XmlData==TypeChar('/')) me_EWaitByte=EWaitByte_EleClose; // ☞ 좌표 (4,25) <요소명 /> else if(*VPC_XmlData==TypeChar('>')) { if((VE_ERunEx=AR_CViewLoadXml. OnElementValueStart(*this))!=ZERunEx_OK) return VE_ERunEx; /*<<<<<<<<<<<<<<<<<<<<<<<<<<*/ me_EWaitByte=EWaitByte_EleValStart; } else // VB_IsSkipChar==true me_EWaitByte=EWaitByte_EleNameSkip; // 좌표 (4,27) "<요소명SkpSkp" //else } else return AR_CViewLoadXml.OnError(*this, *VPC_XmlData); //else } //else if(me_EWaitByte==EWaitByte_EleName) else if(me_EWaitByte==EWaitByte_EleClose) // ☞ 좌표 (4,25) "<요소명/>" { if(*VPC_XmlData==TypeChar('>')) // ☞ 좌표 (4,25) "<요소명/>" { if((VE_ERunEx=AR_CViewLoadXml. OnElementClose(*this, true/*AB_DoHaveSlash*/))!=ZERunEx_OK) return VE_ERunEx; /*<<<<<<<<<<<<<<<<<<<<<<<<<<*/ me_EWaitByte=EWaitByte_EleStart; --mi_EleDepth; } else return AR_CViewLoadXml.OnError(*this, *VPC_XmlData); //else } //else if(me_EWaitByte==EWaitByte_EleClose) // 좌표 (4,25) ☞ "<요/>" else if(me_EWaitByte==EWaitByte_EleNameSkip) // 좌표 (4,27) ☞ "<요 " { if(IsSkipChar(*VPC_XmlData)) {/* nothing to do*/} else if(*VPC_XmlData==TypeChar('/')) { me_EWaitByte=EWaitByte_EleNameSkipClose; // 좌표 (5,28) ☞ "<요 />" } else if(*VPC_XmlData==TypeChar('>')) { if((VE_ERunEx=AR_CViewLoadXml. OnElementValueStart(*this))!=ZERunEx_OK) return VE_ERunEx; /*<<<<<<<<<<<<<<<<<<<<<<<<<<*/ me_EWaitByte=EWaitByte_EleValStart; } else if(IsPropNameChar(*VPC_XmlData)) { VPC_Buff = VPC_XmlData; VI_BuffLen=1; me_EWaitByte= EWaitByte_EleNameSkipProp; if((VE_ERunEx=AR_CViewLoadXml. OnElementPropNameStart(*this))!=ZERunEx_OK) return VE_ERunEx; /*<<<<<<<<<<<<<<<<<<<<<<<<<<*/ } else return AR_CViewLoadXml.OnError(*this, *VPC_XmlData); //else } //else if(me_EWaitByte==EWaitByte_EleNameSkip) // "<요 " else if(me_EWaitByte==EWaitByte_EleNameSkipClose) // 좌표 (5,28) ☞ "<요소명 />" { if(*VPC_XmlData==TypeChar('>')) // 좌표 (5,28) ☞ "<요 />" { const bool CB_DoHaveSlash=true; if((VE_ERunEx=AR_CViewLoadXml. OnElementClose(*this, CB_DoHaveSlash))!=ZERunEx_OK) return VE_ERunEx; /*<<<<<<<<<<<<<<<<<<<<<<<<<<*/ me_EWaitByte=EWaitByte_EleStart; --mi_EleDepth; } else return AR_CViewLoadXml.OnError(*this, *VPC_XmlData); //else } //else if(me_EWaitByte==EWaitByte_EleNameSkipClose) else if(me_EWaitByte==EWaitByte_EleNameSkipProp) // ☞ 좌표 (5,30) "<요 속속" { if(IsPropNameChar(*VPC_XmlData)) // 좌표 (5,30) ☞ "<요 속속" ++VI_BuffLen; else if(*VPC_XmlData==TypeChar('=')) // 좌표 (5,31) ☞ "<요 속=" { if((VE_ERunEx=AR_CViewLoadXml.OnElementPropNameBody (*this, VPC_Buff, VI_BuffLen))!=ZERunEx_OK) return VE_ERunEx; if((VE_ERunEx=AR_CViewLoadXml.OnElementPropNameClose(*this ))!=ZERunEx_OK) return VE_ERunEx; VPC_Buff = 0; VI_BuffLen=0; me_EWaitByte= EWaitByte_EleNameSkipPropQuote; // ☞ 좌표 (6,31) <요 속속=" } else if(*VPC_XmlData==TypeChar('/')) // 좌표 (5,33) ☞ "<요 속/" { if((VE_ERunEx=AR_CViewLoadXml.OnElementPropNameBody (*this, VPC_Buff, VI_BuffLen))!=ZERunEx_OK) return VE_ERunEx; if((VE_ERunEx=AR_CViewLoadXml.OnElementPropNameClose(*this ))!=ZERunEx_OK) return VE_ERunEx; VPC_Buff = 0; VI_BuffLen= 0; me_EWaitByte= EWaitByte_EleNameSkipPropClose; // ☞ 좌표 (6,33) <요 속속/> } else if(*VPC_XmlData==TypeChar('>')) { if((VE_ERunEx=AR_CViewLoadXml.OnElementPropNameBody (*this, VPC_Buff, VI_BuffLen))!=ZERunEx_OK) return VE_ERunEx; if((VE_ERunEx=AR_CViewLoadXml.OnElementPropNameClose(*this ))!=ZERunEx_OK) return VE_ERunEx; if((VE_ERunEx=AR_CViewLoadXml.OnElementValueStart (*this ))!=ZERunEx_OK) return VE_ERunEx; VPC_Buff =0; VI_BuffLen=0 ; me_EWaitByte=EWaitByte_EleValStart; } else if(IsSkipChar(*VPC_XmlData)) { if((VE_ERunEx=AR_CViewLoadXml.OnElementPropNameBody (*this, VPC_Buff, VI_BuffLen))!=ZERunEx_OK) return VE_ERunEx; if((VE_ERunEx=AR_CViewLoadXml.OnElementPropNameClose(*this ))!=ZERunEx_OK) return VE_ERunEx; VPC_Buff = 0; VI_BuffLen=0; //me_EWaitByte= EWaitByte_EleNameSkip; me_EWaitByte= EWaitByte_EleNameSkipProp2; // ☞ 좌표 (6,38) "<요 속" + Skp + Skp } else return AR_CViewLoadXml.OnError(*this, *VPC_XmlData); //else } //else if(me_EWaitByte==EWaitByte_EleNameSkipProp) // 좌표 (5,30) ☞ "<요 속속" else if(me_EWaitByte==EWaitByte_EleNameSkipPropQuote) // 좌표 (6,31) ☞ "<요 속=\"" { if(IsSkipChar(*VPC_XmlData)) {/* nothing to do*/} else if(*VPC_XmlData==TypeChar('"')) { VPC_Buff = VPC_XmlData+1; VI_BuffLen=0 ; me_EWaitByte= EWaitByte_EleNameSkipPropValue; // 좌표 (7,32) ☞ "<요 속=\"속값" if((VE_ERunEx=AR_CViewLoadXml. OnElementPropValueStart(*this))!=ZERunEx_OK) return VE_ERunEx; /*<<<<<<<<<<<<<<<<<<<<<<<<<<*/ } else return AR_CViewLoadXml.OnError(*this, *VPC_XmlData); //else } //else if(me_EWaitByte==EWaitByte_EleNameSkipPropQuote) // 좌표 (6,31) ☞ "<요 속=\"" else if(me_EWaitByte==EWaitByte_EleNameSkipPropValue) // 좌표 (7,32) ☞ "<요 속=\"속값" { if(IsPropValueChar(*VPC_XmlData)) ++VI_BuffLen; else if(*VPC_XmlData==TypeChar('"')) // 좌표 (7,32) ☞ "<요 속=\"\"" { if((VE_ERunEx=AR_CViewLoadXml.OnElementPropValueBody (*this, VPC_Buff, VI_BuffLen))!=ZERunEx_OK) return VE_ERunEx; if((VE_ERunEx=AR_CViewLoadXml.OnElementPropValueClose(*this ))!=ZERunEx_OK) return VE_ERunEx; VPC_Buff = 0; VI_BuffLen=0; //me_EWaitByte= EWaitByte_EleNameSkip; // 좌표 (4,27) ☞ "<요요 " me_EWaitByte= EWaitByte_EleNameSkipPropValue2; // 좌표 (8,33) ☞ "<요 속=\"\"" + Skp } else return AR_CViewLoadXml.OnError(*this, *VPC_XmlData); //else } //else if(me_EWaitByte==EWaitByte_EleNameSkipPropValue) // 좌표 (7,31) ☞ "<요 속=\"속값" else if(me_EWaitByte==EWaitByte_EleNameSkipPropValue2) // 좌표 (8,33) ☞ "<요 속=\"속값\" + Skp { if(IsSkipChar(*VPC_XmlData)) { me_EWaitByte=EWaitByte_EleNameSkip; // 좌표 (4,27) ☞ "<요 " + Skp } else if(*VPC_XmlData==TypeChar('/')) { me_EWaitByte=EWaitByte_EleNameSkipPropClose; // 좌표 (7,3A) ☞ "<요 속=\"속값\"" + Skp + "/>" } else if(*VPC_XmlData==TypeChar('>')) { if((VE_ERunEx=AR_CViewLoadXml. OnElementValueStart(*this))!=ZERunEx_OK) return VE_ERunEx; /*<<<<<<<<<<<<<<<<<<<<<<<<<<*/ me_EWaitByte=EWaitByte_EleValStart; } else return AR_CViewLoadXml.OnError(*this, *VPC_XmlData); //else } //else if(me_EWaitByte==EWaitByte_EleNameSkipPropValue2) // 좌표 (8,33) ☞ "<요 속=\"속값\" + Skp else if(me_EWaitByte==EWaitByte_EleNameSkipPropClose) // 좌표 (6,33) ☞ "<요 속속/>" { if(*VPC_XmlData==TypeChar('>')) { const bool CB_DoHaveSlash=true; if((VE_ERunEx=AR_CViewLoadXml. OnElementClose(*this, CB_DoHaveSlash))!=ZERunEx_OK) return VE_ERunEx; /*<<<<<<<<<<<<<<<<<<<<<<<<<<*/ --mi_EleDepth; me_EWaitByte=EWaitByte_EleStart; // 좌표 (1,21) ☞ "<" } else return AR_CViewLoadXml.OnError(*this, *VPC_XmlData); //else } //else if(me_EWaitByte==EWaitByte_EleNameSkipPropClose) // 좌표 (6,33) ☞ "<요 속속/>" else if(me_EWaitByte==EWaitByte_EleNameSkipProp2) // 좌표 (6,38) ☞ "<요 속" + Skp + Skp { if(IsSkipChar(*VPC_XmlData)) {/* nothing to do*/} else if(*VPC_XmlData==TypeChar('=')) { me_EWaitByte=EWaitByte_EleNameSkipPropQuote; // 좌표 (6,31) ☞ "<요 속=" + Skp } else if(*VPC_XmlData==TypeChar('/')) { me_EWaitByte=EWaitByte_EleNameSkipPropClose; // 좌표 (7,3A) ☞ "<요 속" + Skp +Skp + "/>" } else if(*VPC_XmlData==TypeChar('>')) { if((VE_ERunEx=AR_CViewLoadXml. OnElementValueStart(*this))!=ZERunEx_OK) return VE_ERunEx; /*<<<<<<<<<<<<<<<<<<<<<<<<<<*/ me_EWaitByte=EWaitByte_EleValStart; } else return AR_CViewLoadXml.OnError(*this, *VPC_XmlData); //else } //else if(me_EWaitByte==EWaitByte_EleNameSkipProp2) // 좌표 (6,38) ☞ "<요 속 + Skp +Skp else if(me_EWaitByte==EWaitByte_EleCloseComplete) // 좌표 (3,3C) ☞ "')) { // VI_BuffLen>0 if((VE_ERunEx=AR_CViewLoadXml.OnElementName2Body (*this, VPC_Buff, VI_BuffLen))!=ZERunEx_OK) return VE_ERunEx; if((VE_ERunEx=AR_CViewLoadXml.OnElementName2Close(*this ))!=ZERunEx_OK) return VE_ERunEx; if((VE_ERunEx=AR_CViewLoadXml.OnElementClose (*this ))!=ZERunEx_OK) return VE_ERunEx; VPC_Buff = 0; VI_BuffLen=0; --mi_EleDepth; me_EWaitByte= EWaitByte_EleStart; // 좌표 (1,21) ☞ "<" } else return AR_CViewLoadXml.OnError(*this, *VPC_XmlData); //else } //else if(me_EWaitByte==EWaitByte_EleCloseComplete2) // 좌표 (4,3C) ☞ "" else { if((VE_ERunEx=AR_CViewLoadXml. OnCommentBody(*this, TypeChar('-')))!=ZERunEx_OK) return VE_ERunEx; /*<<<<<<<<<<<<<<<<<<<<<<<<<<*/ me_EWaitByte= EWaitByte_EleValCommValue ; // 좌표 (5,43) ☞ "" { if(*VPC_XmlData==TypeChar('>')) { if((VE_ERunEx=AR_CViewLoadXml. OnCommentClose(*this))!=ZERunEx_OK) {return VE_ERunEx;} /*<<<<<<<<<<<<<<<<<<<<<<<<<<*/ me_EWaitByte=EWaitByte_EleValStart; } else if(*VPC_XmlData==TypeChar('-')) // "---" 중 맨 앞 글자만 주석이다. { if((VE_ERunEx=AR_CViewLoadXml.OnCommentBody(*this, TypeChar('-')))!=ZERunEx_OK) return VE_ERunEx; } else { if((VE_ERunEx=AR_CViewLoadXml.OnCommentBody(*this, TypeChar('-')))!=ZERunEx_OK) return VE_ERunEx; if((VE_ERunEx=AR_CViewLoadXml.OnCommentBody(*this, TypeChar('-')))!=ZERunEx_OK) return VE_ERunEx; me_EWaitByte= EWaitByte_EleValCommValue; VPC_Buff = VPC_XmlData; VI_BuffLen=1; } //else } //else if(me_EWaitByte==EWaitByte_EleValCommEnd) // 좌표 (7,43) ☞ "" else if(me_EWaitByte==EWaitByte_EleValCDataC) // 좌표 (4,44) ☞ "" else { if((VE_ERunEx=AR_CViewLoadXml. OnEleCDATA_Body(*this, TypeChar(']')))!=ZERunEx_OK) return VE_ERunEx; /*<<<<<<<<<<<<<<<<<<<<<<<<<<*/ me_EWaitByte= EWaitByte_EleValCDataContent; VPC_Buff = VPC_XmlData; VI_BuffLen=1 ; } //else } //else if(me_EWaitByte==EWaitByte_EleValCDataClose2) // 좌표 (11,45) ☞ "" { if(*VPC_XmlData==TypeChar('>')) { if((VE_ERunEx=AR_CViewLoadXml.OnEleCDATA_Close(*this))!=ZERunEx_OK) {return VE_ERunEx;} me_EWaitByte=EWaitByte_EleCloseOpen; // 좌표 (1,61) ☞ "<" } else if(*VPC_XmlData==TypeChar(']')) { if((VE_ERunEx=AR_CViewLoadXml.OnEleCDATA_Body(*this, TypeChar(']')))!=ZERunEx_OK) return VE_ERunEx; } else { if((VE_ERunEx=AR_CViewLoadXml.OnEleCDATA_Body(*this, TypeChar(']')))!=ZERunEx_OK) return VE_ERunEx; if((VE_ERunEx=AR_CViewLoadXml.OnEleCDATA_Body(*this, TypeChar(']')))!=ZERunEx_OK) return VE_ERunEx; VPC_Buff = VPC_XmlData; VI_BuffLen=1 ; me_EWaitByte= EWaitByte_EleValCDataContent; } //else } //else if(me_EWaitByte==EWaitByte_EleValCDataClose3) // 좌표 (12,45) ☞ "" else if(me_EWaitByte==EWaitByte_EleValCloseName1) // 좌표 (3,47) ☞ "')) // 좌표 (4,48) ☞ "" { // VI_BuffLen>0 if((VE_ERunEx=AR_CViewLoadXml.OnElementName2Body (*this, VPC_Buff, VI_BuffLen))!=ZERunEx_OK) return VE_ERunEx; if((VE_ERunEx=AR_CViewLoadXml.OnElementName2Close(*this ))!=ZERunEx_OK) return VE_ERunEx; if((VE_ERunEx=AR_CViewLoadXml.OnElementClose (*this ))!=ZERunEx_OK) return VE_ERunEx; VPC_Buff = 0 ; VI_BuffLen=0; --mi_EleDepth; me_EWaitByte= EWaitByte_EleStart; // 좌표 (1,21) ☞ "<" } else return AR_CViewLoadXml.OnError(*this, *VPC_XmlData); //else } //else if(me_EWaitByte==EWaitByte_EleValCloseName2) // 좌표 (4,47) ☞ "" 형태가 되는데, 이렇게 요소를 닫는 시점이 명확한 상태에서 PCDATA 에 대한 종료 처리 함수 OnElePCDATA_Close() 을 호출한다. -- 2011-09-23 01:03:00 //////////////////////////////////////////////////////////////////*/ if((VE_ERunEx=AR_CViewLoadXml.OnElePCDATA_Close (*this))!=ZERunEx_OK) return VE_ERunEx; if((VE_ERunEx=AR_CViewLoadXml.OnElementName2Start(*this))!=ZERunEx_OK) return VE_ERunEx; VPC_Buff = VPC_XmlData+1; VI_BuffLen= 0; me_EWaitByte= EWaitByte_EleValPCDataCloseEle; // 좌표 (3,54) ☞ "" } else { if((VE_ERunEx=AR_CViewLoadXml. OnCommentBody(*this, TypeChar('-')))!=ZERunEx_OK) {return VE_ERunEx;} /*<<<<<<<<<<<<<<<<<<<<<<<<<<*/ me_EWaitByte= EWaitByte_EleValPCDataCommValue; // 좌표 (5,52) ☞ "" { if(*VPC_XmlData==TypeChar('>')) { if((VE_ERunEx=AR_CViewLoadXml. OnCommentClose(*this))!=ZERunEx_OK) { return VE_ERunEx; } /*<<<<<<<<<<<<<<<<<<<<<<<<<<*/ me_EWaitByte=EWaitByte_EleValPCData; // 좌표 (1,51) ☞ "PCD" } else if(*VPC_XmlData==TypeChar('-')) // "---" 중 맨 앞 글자만 주석이다. { if((VE_ERunEx=AR_CViewLoadXml.OnCommentBody(*this, TypeChar('-')))!=ZERunEx_OK) return VE_ERunEx; } else { if((VE_ERunEx=AR_CViewLoadXml.OnCommentBody(*this, TypeChar('-')))!=ZERunEx_OK) return VE_ERunEx; if((VE_ERunEx=AR_CViewLoadXml.OnCommentBody(*this, TypeChar('-')))!=ZERunEx_OK) return VE_ERunEx; me_EWaitByte= EWaitByte_EleValPCDataCommValue; // 좌표 (5,52) ☞ "" else if(me_EWaitByte==EWaitByte_EleValPCDataCloseEle) // 좌표 (3,54) ☞ "')) { // VI_BuffLen>0 if((VE_ERunEx=AR_CViewLoadXml.OnElementName2Body (*this, VPC_Buff, VI_BuffLen))!=ZERunEx_OK) return VE_ERunEx; if((VE_ERunEx=AR_CViewLoadXml.OnElementName2Close(*this ))!=ZERunEx_OK) return VE_ERunEx; if((VE_ERunEx=AR_CViewLoadXml.OnElementClose (*this ))!=ZERunEx_OK) return VE_ERunEx; VPC_Buff = 0; VI_BuffLen=0; --mi_EleDepth; me_EWaitByte= EWaitByte_EleStart ; // 좌표 (1,21) ☞ "<" } else return AR_CViewLoadXml.OnError(*this, *VPC_XmlData); //else } //else if(me_EWaitByte==EWaitByte_EleValPCDataCloseEle2) // 좌표 ☞ (4,54) "" else { if((VE_ERunEx=AR_CViewLoadXml. OnCommentBody(*this, TypeChar('-')))!=ZERunEx_OK) return VE_ERunEx; /*<<<<<<<<<<<<<<<<<<<<<<<<<<*/ VPC_Buff = VPC_XmlData; VI_BuffLen= 1; me_EWaitByte= EWaitByte_EleCloseCommValue; // 좌표 ☞ (5,62) "" { if(*VPC_XmlData==TypeChar('>')) { if((VE_ERunEx=AR_CViewLoadXml. OnCommentClose(*this))!=ZERunEx_OK) return VE_ERunEx; /*<<<<<<<<<<<<<<<<<<<<<<<<<<*/ me_EWaitByte= EWaitByte_EleStart; // 좌표 ☞ (1,21) "<" } else if(*VPC_XmlData==TypeChar('-')) { if((VE_ERunEx=AR_CViewLoadXml. OnCommentBody(*this, TypeChar('-')))!=ZERunEx_OK) return VE_ERunEx; /*<<<<<<<<<<<<<<<<<<<<<<<<<<*/ } else { if((VE_ERunEx=AR_CViewLoadXml.OnCommentBody(*this, TypeChar('-')))!=ZERunEx_OK) return VE_ERunEx; if((VE_ERunEx=AR_CViewLoadXml.OnCommentBody(*this, TypeChar('-')))!=ZERunEx_OK) return VE_ERunEx; VPC_Buff = VPC_XmlData; VI_BuffLen= 1 ; me_EWaitByte= EWaitByte_EleCloseCommValue; // 좌표 ☞ (5,62) "" else if(me_EWaitByte==EWaitByte_EleCloseName) // 좌표 ☞ (3,64) "')) { const bool CB_DoHaveSlash=false; if((VE_ERunEx=AR_CViewLoadXml.OnElementName2Body (*this, VPC_Buff, VI_BuffLen))!=ZERunEx_OK) return VE_ERunEx; if((VE_ERunEx=AR_CViewLoadXml.OnElementName2Close(*this ))!=ZERunEx_OK) return VE_ERunEx; if((VE_ERunEx=AR_CViewLoadXml.OnElementClose (*this, CB_DoHaveSlash ))!=ZERunEx_OK) return VE_ERunEx; VPC_Buff=0; VI_BuffLen=0; --mi_EleDepth; me_EWaitByte=EWaitByte_EleStart; // 좌표 ☞ (1,21) "<" } else return AR_CViewLoadXml.OnError(*this, *VPC_XmlData); //else } //else if(me_EWaitByte==EWaitByte_EleCloseName2) // 좌표 ☞ (4,64) " ZERunEx Exec ( TViewLoadXml& AR_CViewLoadXml , const TypeChar* APC_XmlData , TypeLength AI_DataLen ) /*#############################################################################*/ template ZERunEx Exec(TViewLoadXml& AR_CViewLoadXml, const TMainChars& AR_CMainChars) { return Exec(AR_CViewLoadXml, AR_CMainChars.data(), AR_CMainChars.size()); }/* template ZERunEx Exec(TViewLoadXml& AR_CViewLoadXml, const TMainChars& AR_CMainChars) */ template ZERunEx ExecAll( TViewLoadXml& AR_CViewLoadXml, const TypeChar* APC_XmlData, TypeLength AI_DataLen) { clear(); return Exec(AR_CViewLoadXml, APC_XmlData, AI_DataLen); }/* template ZERunEx ExecAll( TViewLoadXml& AR_CViewLoadXml, const TypeChar* APC_XmlData, TypeLength AI_DataLen)*/ template ZERunEx ExecAll(TViewLoadXml& AR_CViewLoadXml, const TMainChars& AR_CMainChars) { clear(); return Exec(AR_CViewLoadXml, AR_CMainChars); }/* template ZERunEx ExecAll(TViewLoadXml& AR_CViewLoadXml, const TMainChars& AR_CMainChars) */ public: };/* template< typename TStringData=ZNsMain::ZtCStringBase > class ZtCLoadXml //////////////////////////////////////////*/ }/* namespace ZNsMain*/ /*//////////////////////////////////////////////////////////////////////////////////////////// ■ DTD(Document Type Definition) 는 문서에 포함되어 있는 엘리먼트, 속성, 엔티티의 목록을 제공 하고, 그들 간의 관계에 대해 정의한다. 일반적으로 Xml 문서는 프롤로그, DTD(외부 또는 내부가 될 수 있다), 몸통으로 구성되어 있다. 문서 타입 선언(Document Type Declarations)은 DTD 가 아니다. 약어가 같아서 혼동할 수 있다. 아래 xml 에서 ]> hello world! 문서 타입 선언(Document Type Declarations)은 ]> 이고, DTD(Document Type Definition) 는 이다. DTD 가 없는 문서는 유효하지 않은 문서이다. -- 2011-10-25 16:11:00 ■ Entity □ XML 문서는 하나 또는 그 이상의 저장 단위들로 구성이 가능하다. 이 각각의 저장 단위를 Entity 라 한다. 이들 Entity 는 모두 내용(content)을 가지고 있으며, 모드 이름(name)으로 인식된 다. 이러한 Entity 는 파일로도 구성이 가능하며, 그 외에도 데이타베이스의 레코드, 데이타 를 담을 수 있는 다른 형식의 object 로도 구성되어질 수 있다. □ XML 문서는 '문서 Entity'라 불리는 하나의 Entity 를 갖는데, 이것은 XML 선언을 담는 문서 타입 선언과 루트 엘리먼트를 말한다. 이는 XML 처리자(Processor)의 시작점으로 작용한다. Entity 의 이름은 작성자가 지정할 수 있는 이름을 가지고 있는 것이 대부분이라고 할 수 있 다. 하지만 이중 예외가 있는데, XML 문서를 담고 있는 메인 파일인 '문서 Entity'이다. '문 서 Entity'는 XML 선언, 루트 엘리먼트를 가지고 있기 때문에, XML 문서는 한 개 이상의 Entity 를 가지게 된다. □ Entity 는 '파싱된 Entity'(Parsed Entity)와 '파싱되지 않은 Entity'(Unparsed Entity)로 나 누어진다. '파싱된 Entity'는 잘 구성된 XML 텍스트를 포함하는 것을 말한다. '파싱되지 않은 Entity'는 바이너리 데이타가 있는데, 아쉽게도 현재는 잘 지원되지 않고 있다. □ Entity 는 또 '내부 Entity'와 '외부 Entity'로도 나눌 수 있다. '내부 Entity'는 문서의 내 부에서 완전히 정의되는 Entity 를 말하고, '외부 Entity'는 URL 을 통해 다른 소스에서 컨텐 트를 받아오는 것을 말한다. 문서는 그 자체로도 하나의 Entity 라 말할 수 있다. 따라서 모 든 XML 문서는 최소한 한 개의 '내부 Entity'를 가지고 있는 것이다. 내부 Entity=Internal Entity 외부 Entity=External Entity □ '내부 Entity' 예. ]> &hi; □ '외부 Entity'는 루트 엘리먼트와 문서 Entity 를 포함하고 있는 메인 파일의 밖에 있는 데이 타를 말한다. 이를 통해서 XML 문서는 여러 개의 독립된 파일로부터 하나의 문서를 구축할 수 있게 된다. 아래는 '외부 Entity' 선언 예다. □ 사전에 정의된 Entity. -- 2011-10-26 23:05:00 ////////////////////////////////////////////////////////////////////////////////////////////*/ #endif //__ZNSMAIN_ZTCLOADXML_H__