FEDM_XmlBase.h
Go to the documentation of this file.
00001 /*-------------------------------------------------------
00002 |                                                       |
00003 |                     FEDM_XMLBase.h                    |
00004 |                                                       |
00005 ---------------------------------------------------------
00006 
00007 Copyright © 2000-2011   FEIG ELECTRONIC GmbH, All Rights Reserved.
00008                                                 Lange Strasse 4
00009                                                 D-35781 Weilburg
00010                                                 Federal Republic of Germany
00011                                                 phone    : +49 6471 31090
00012                                                 fax      : +49 6471 310999
00013                                                 e-mail   : obid-support@feig.de
00014                                                 Internet : http://www.feig.de
00015                                         
00016 Author                  :       Markus Hultsch
00017 Begin                   :       01.04.2003
00018 Version                 :       04.00.02 / 22.08.2011 / M. Hultsch
00019 
00020 Operation Systems       :       independent
00021 
00022 Function                        :       base class for XML document handler
00023                                                 
00024 Note                            :       this XML document handler is designed only for use
00025                                                 inside the class library FEDM !!
00026 
00027 
00028 Trademarks:
00029 -----------
00030 OBID®, OBID i-scan® and OBID myAXXESS® are registered Trademarks of FEIG ELECTRONIC GmbH
00031 Other Trademarks: see FEDM.h
00032 */
00033 
00034 
00035 
00036 #if !defined(_FEDM_XMLBASE_H_INCLUDED_)
00037 #define _FEDM_XMLBASE_H_INCLUDED_
00038 
00039 
00040 
00041 #ifdef _FEDM_XML_SUPPORT
00042 
00043 
00044 #include "FEDM.h"
00045 #include "FEDM_Xml.h"
00046 
00047 
00048 
00049 class _FEDM_ISC_CORE_EXT_CLASS FEDM_XMLBase
00050 {
00051 public:
00052         FEDM_XMLBase();
00053         ~FEDM_XMLBase();
00054         void DeleteXmlTree();
00055 
00056         // query functions
00057         int QueryDocType(char* sFileName, char* sDocType, char* sDocVersion);
00058         int QueryDocType(char* sFileName, const char* sRootTag, char* sDocType, char* sDocVersion);
00059 
00060         // document management
00061         int OpenDoc(char* sFileName, char* sMode, bool bAddCopyright=false);    // open a xml document
00062         int CloseDoc();                                         // close xml document
00063         int IsXmlDoc();                                         // checks the xml header
00064         int HasOBIDTag();                                       // checks, if tag <OBID> is found
00065         int HasRootTag(const char* szOemRootTag);       // checks, if tag <szOemRootTag> is found
00066         int ReadDoc();                                          // read the xml text from file and put it into m_sXmlStream
00067         int WriteDoc();                                         // write the xml text from m_sXmlStream into file
00068         wstring WriteStream();                          // build and return m_sXmlStream
00069         int LoadStream(wstring sXmlStream);     // load xml string
00070 
00071         // tag functions for creating and building the xml tree
00072         FEDM_XML_TREEITEM* BuildTag(wstring sTag, bool bNewLine=true, bool bEmpty=false);
00073         int AddTagValue(FEDM_XML_TREEITEM* item, wstring sValue);
00074         int AddTagAttrib(FEDM_XML_TREEITEM* item, wstring sAttrib, wstring sValue);
00075         int AddTagItem(FEDM_XML_TREEITEM* pParent, FEDM_XML_TREEITEM* pChild);
00076 
00077         // tag functions for searching in raw xml text string
00078         FEDM_XML_TREEITEM* FindTag( wstring sTag,
00079                                                                 bool bInside=false,
00080                                                                 bool bSavePos=false,
00081                                                                 bool bNext=false);
00082         FEDM_XML_TREEITEM* FindTag(     wstring sTag,
00083                                                                 wstring sAttribute,
00084                                                                 bool bInside=false,
00085                                                                 bool bSavePos=false);
00086         FEDM_XML_TREEITEM* FindTag( wstring sTag,
00087                                                                 wstring sAttribName, 
00088                                                                 wstring sAttribValue, 
00089                                                                 bool bInside=false,
00090                                                                 bool bSavePos=false);
00091         
00092         FEDM_XML_TREEITEM* FindTag(     wstring sTag,
00093                                                                 unsigned int uiTagLevel,
00094                                                                 bool bNext=false);
00095         FEDM_XML_TREEITEM* FindTag(     wstring sTag,
00096                                                                 wstring sAttribute,
00097                                                                 unsigned int uiTagLevel,
00098                                                                 bool bNext=false);
00099         
00100         // functions for query content from xml tree
00101 //      FEDM_XML_TREEITEM* GetRootTag();
00102 //      FEDM_XML_TREEITEM* GetChildTag(int iIndex);
00103 //      int GetTagChildCount(FEDM_XML_TREEITEM* item);
00104         int GetTagValue(FEDM_XML_TREEITEM* item, string& sValue);
00105         int GetTagAttribCount(FEDM_XML_TREEITEM* item);
00106         int GetTagAttrib(FEDM_XML_TREEITEM* item, int iIndex, string& sAttrib, string& sValue);
00107         int GetTagAttrib(FEDM_XML_TREEITEM* item, int iIndex, wstring& wsAttrib, wstring& wsValue);
00108 
00109         // query functions
00110         int GetLastError();
00111 
00112 //      void SetComment(wstring sComment);
00113 
00114 protected:
00115         void SetLastError(int iError);
00116 
00117         // functions for deleting xml tree
00118         int DeleteTagItem(FEDM_XML_TREEITEM* item);     // for recursive use
00119 
00120         // function for writing one tag into the xml string
00121         int WriteTagStream(FEDM_XML_TREEITEM* item);
00122 
00123         // function for reading xml header
00124         int ReadXmlHeader(char* cBuffer);
00125 
00126         void AddComment();
00127 
00128         int             m_iLastError;                   // last error code
00129 
00130         wstring m_sXmlStream;                   // reader firmware data (xml text in UNICODE)
00131         wstring m_sXmlComment;                  // comment in XML file
00132         FILE* m_file;                                   // file handle
00133         FEDM_XML_TREE_LIST m_XmlTree;   // tree with xml items
00134 
00135         // file header
00136         wstring m_wsXmlVer;
00137         wstring m_wsEncoding;
00138         wstring m_wsStandalone;
00139         wstring m_wsDocType;
00140         wstring m_wsDocVer;
00141         wstring m_wsDate;
00142         wstring m_wsTime;
00143 };
00144 
00145 #endif // #ifdef _FEDM_XML_SUPPORT
00146 
00147 #endif // !defined(_FEDM_XMLBASE_H_INCLUDED_)


maggie_rfid_drivers
Author(s): Raul Perula-Martinez
autogenerated on Mon Sep 14 2015 03:05:29