FEDM_XmlParser_FedmReader.cpp
Go to the documentation of this file.
00001 /*-------------------------------------------------------
00002 |                                                       |
00003 |       FEDM_XmlParser_FedmReader.cpp                                           |
00004 |                                                       |
00005 ---------------------------------------------------------
00006 
00007 Copyright © 2008                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                   :       06.02.2008
00018 Version                         :       03.00.08 / 30.06.2009 / M. Hultsch
00019 Operation Systems       :       independent
00020 Function                        :       xml reader class based on FEDM parser API
00021 
00022 OBID® and OBID i-scan® are registered Trademarks of FEIG ELECTRONIC GmbH.
00023 Linux® is a registered trademark of Linus Torvalds.
00024 Microsoft® and Windows® are registered trademarks of Microsoft Corporation.
00025 */
00026 
00027 
00028 //#############################
00029 //      I N C L U D E S
00030 //#############################
00031 #include "FEDM_XmlParser_FedmReader.h"                          // public include file of library
00032 #include "FEDM_XmlParser_Base.h"
00033 
00034 
00035 //#######################################################################################
00036 //      class FEDM_XmlParser_FedmReader
00037 //#######################################################################################
00038 FEDM_XmlParser_FedmReader::FEDM_XmlParser_FedmReader(void)
00039 {
00040 }
00041 
00042 
00043 FEDM_XmlParser_FedmReader::~FEDM_XmlParser_FedmReader(void)
00044 {
00045 }
00046 
00047 // open a xml document
00048 int FEDM_XmlParser_FedmReader::OpenDoc(char* sFileName)
00049 {
00050         CloseDoc();
00051 
00052         return FEDM_XMLBase::OpenDoc(sFileName, "r");
00053 }
00054 
00055 // close xml document
00056 int FEDM_XmlParser_FedmReader::CloseDoc()
00057 {
00058         return FEDM_XMLBase::CloseDoc();
00059 }
00060 
00061 // read the xml text from file
00062 int FEDM_XmlParser_FedmReader::LoadDoc()
00063 {
00064         // is it a xml document?
00065         if(FEDM_XMLBase::IsXmlDoc())
00066         {
00067                 FEDM_XMLBase::CloseDoc();
00068                 return m_iLastError;
00069         }
00070 
00071         // has the xml document an OBID tag?
00072         if(FEDM_XMLBase::HasOBIDTag())
00073         {
00074                 FEDM_XMLBase::CloseDoc();
00075                 return m_iLastError;
00076         }
00077         
00078         // read complete xml document into string
00079         if(FEDM_XMLBase::ReadDoc())
00080         {
00081                 FEDM_XMLBase::CloseDoc();
00082                 return m_iLastError;
00083         }
00084 
00085         return FEDM_XMLBase::CloseDoc();
00086 }
00087 
00088 // read the xml text from file
00089 int FEDM_XmlParser_FedmReader::LoadDoc(const char* szOemRootTag)
00090 {
00091         // is it a xml document?
00092         if(FEDM_XMLBase::IsXmlDoc())
00093         {
00094                 FEDM_XMLBase::CloseDoc();
00095                 return m_iLastError;
00096         }
00097 
00098         if(strlen(szOemRootTag) > 0)
00099         {
00100                 // has the xml document an OBID tag?
00101                 if(FEDM_XMLBase::HasRootTag(szOemRootTag))
00102                 {
00103                         FEDM_XMLBase::CloseDoc();
00104                         return m_iLastError;
00105                 }
00106         }
00107         else
00108         {
00109                 // has the xml document an OBID tag?
00110                 if(FEDM_XMLBase::HasOBIDTag())
00111                 {
00112                         FEDM_XMLBase::CloseDoc();
00113                         return m_iLastError;
00114                 }
00115         }
00116         
00117         // read complete xml document into string
00118         if(FEDM_XMLBase::ReadDoc())
00119         {
00120                 FEDM_XMLBase::CloseDoc();
00121                 return m_iLastError;
00122         }
00123 
00124         return FEDM_XMLBase::CloseDoc();
00125 }
00126 
00127 int FEDM_XmlParser_FedmReader::LoadStream(wstring sXmlStream)
00128 {
00129         return FEDM_XMLBase::LoadStream(sXmlStream);
00130 }
00131 
00132 void FEDM_XmlParser_FedmReader::DeleteXmlTree()
00133 {
00134         FEDM_XMLBase::DeleteXmlTree();
00135 }
00136 
00137 int FEDM_XmlParser_FedmReader::AddTagItem(FEDM_XML_TREEITEM* pParent, FEDM_XML_TREEITEM* pChild)
00138 {
00139         return FEDM_XMLBase::AddTagItem(pParent, pChild);
00140 }
00141 
00142 FEDM_XML_TREEITEM* FEDM_XmlParser_FedmReader::FindTag(  wstring sTag,
00143                                                                                                                 unsigned int uiTagLevel,
00144                                                                                                                 bool bNext )
00145 {
00146         FEDM_XML_TREEITEM* item = FEDM_XMLBase::FindTag(sTag, uiTagLevel, bNext);
00147         if(item == NULL)
00148                 m_pXmlParser->SetLastError(m_iLastError);
00149         else
00150                 m_pXmlParser->SetLastError(FEDM_OK);
00151 
00152         return item;
00153 }
00154 
00155 FEDM_XML_TREEITEM* FEDM_XmlParser_FedmReader::FindTag(  wstring sTag,
00156                                                                                                                 wstring sAttribute,
00157                                                                                                                 unsigned int uiTagLevel,
00158                                                                                                                 bool bNext )
00159 {
00160         FEDM_XML_TREEITEM* item =  FEDM_XMLBase::FindTag(sTag, sAttribute, uiTagLevel, bNext);
00161         if(item == NULL)
00162                 m_pXmlParser->SetLastError(m_iLastError);
00163         else
00164                 m_pXmlParser->SetLastError(FEDM_OK);
00165 
00166         return item;
00167 }


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