Eneboo - Documentación para desarrolladores
src/libdigidoc/DigiDocStack.h
Ir a la documentación de este archivo.
00001 #ifndef __DIGIDOC_STACK_H__
00002 #define __DIGIDOC_STACK_H__
00003 //==================================================
00004 // FILE:        DigiDocStack.h
00005 // PROJECT:     Digi Doc
00006 // DESCRIPTION: Digi Doc functions for simple stack
00007 //  to keep track of xml parsing
00008 // AUTHOR:  Veiko Sinivee, S|E|B IT Partner Estonia
00009 //==================================================
00010 // Copyright (C) AS Sertifitseerimiskeskus
00011 // This library is free software; you can redistribute it and/or
00012 // modify it under the terms of the GNU Lesser General Public
00013 // License as published by the Free Software Foundation; either
00014 // version 2.1 of the License, or (at your option) any later version.
00015 // This library is distributed in the hope that it will be useful,
00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 // GNU Lesser General Public Licence is available at
00020 // http://www.gnu.org/copyleft/lesser.html
00021 //==========< HISTORY >=============================
00022 //      09.09.2004      Veiko Sinivee
00023 //                      Creation
00024 //==================================================
00025 
00026 #include <libxml/xmlreader.h>
00027 #include <libdigidoc/DigiDocDefs.h>
00028 
00029 #ifdef  __cplusplus
00030 extern "C" {
00031 #endif
00032 
00033 typedef struct ElementEntry_st {
00034   xmlChar* tag;     // xml elements tag
00035   xmlChar* prefix;  // namespace local prefix
00036   xmlChar* nsUri;   // namespace URI
00037   // some important atributes
00038   xmlChar* id;      // attribute "Id"
00039   xmlChar* uri;     // attribute "URI"
00040   xmlChar* content; // attribute "ContentType"
00041   void* pNext;      // next element in list/stack
00042 } ElementEntry;
00043 
00044 //--------------------------------------------------
00045 // Finds the last element on stack
00046 // reader - XML reader cursor to current node
00047 // pStack - address of stack begin. This one elemnt 
00048 // must exist, but might be initially empty
00049 // return error code or ERR_OK
00050 //--------------------------------------------------
00051 ElementEntry* ddocStackFindEnd(ElementEntry* pStack);
00052 
00053 //--------------------------------------------------
00054 // Push a new element info onto stack
00055 // reader - XML reader cursor to current node
00056 // pStack - address of stack begin. This one elemnt 
00057 // must exist, but might be initially empty
00058 // pLastElem - address for new elements pointer. 
00059 //   If not NULL then will be used to return the
00060 //   newly allocated elemnt, so you don't have to
00061 //   do a new search.
00062 // return error code or ERR_OK
00063 //--------------------------------------------------
00064 int ddocStackPushElement(ElementEntry* pStack, xmlTextReaderPtr reader,
00065                          ElementEntry** pLastElem);
00066 
00067 //--------------------------------------------------
00068 // Push a new element info onto stack
00069 // tagName - elements tag name, Possibly with ns-prefix
00070 // atts - array of atributa names and values
00071 // pStack - address of stack begin. This one elemnt 
00072 // must exist, but might be initially empty
00073 // pLastElem - address for new elements pointer. 
00074 //   If not NULL then will be used to return the
00075 //   newly allocated elemnt, so you don't have to
00076 //   do a new search.
00077 // return error code or ERR_OK
00078 //--------------------------------------------------
00079 int ddocStackPushElementSAX(ElementEntry* pStack, const xmlChar* tagName,
00080                             const xmlChar** atts, ElementEntry** pLastElem);
00081 
00082 //--------------------------------------------------
00083 // Pop the last element from the stack
00084 // pStack - address of stack begin. This one elemnt 
00085 // must exist, and will never be deleted. 
00086 // bCleanup - flag: 1=cleanup the whole stack, 0=just the last element
00087 // return error code or ERR_OK
00088 // pLastElem - address for new elements pointer. 
00089 //   If not NULL then will be used to return the
00090 //   last element on stack.
00091 //--------------------------------------------------
00092 int ddocStackPopElement(ElementEntry* pStack, int bCleanup, 
00093                         ElementEntry** pLastElem);
00094 
00095 //--------------------------------------------------
00096 // Retrieve the current/last/stack top elements tag (localname)
00097 // pStack - address of stack begin.
00098 //--------------------------------------------------
00099 const xmlChar* ddocStackCurrentTag(ElementEntry* pStack);
00100 
00101 //--------------------------------------------------
00102 // Retrieve the current/last/stack top elements ns prefix
00103 // pStack - address of stack begin.
00104 //--------------------------------------------------
00105 const xmlChar* ddocStackCurrentNsPrefix(ElementEntry* pStack);
00106 
00107 //--------------------------------------------------
00108 // Retrieve the current/last/stack top elements ns prefix
00109 // pStack - address of stack begin.
00110 //--------------------------------------------------
00111 const xmlChar* ddocStackCurrentNsUri(ElementEntry* pStack);
00112 
00113 //--------------------------------------------------
00114 // Checks if there is a parent element with the given
00115 // localname on the stack.
00116 // pStack - address of stack begin.
00117 // return 1 if there is such a parent elem or 0 if not.
00118 //--------------------------------------------------
00119 int ddocStackHasParentWithName(ElementEntry* pStack, 
00120                                const xmlChar* parentsName, ElementEntry* pCurrElem);
00121 
00122 //--------------------------------------------------
00123 // Checks if there is a parent element with the given
00124 // localname on the stack.
00125 // pStack - address of stack begin.
00126 // return 1 if there is such a parent elem or 0 if not.
00127 //--------------------------------------------------
00128 ElementEntry* ddocStackGetParentWithName(ElementEntry* pStack, 
00129                                          const xmlChar* parentsName, ElementEntry* pCurrElem);
00130 
00131 
00132 
00133 #ifdef  __cplusplus
00134 }
00135 #endif
00136 
00137 #endif // __DIGIDOC_STACK_H__
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'