00001 /********************************************************************** 00002 * $Id: cpl_minixml.h,v 1.8 2003/03/27 18:12:41 warmerda Exp $ 00003 * 00004 * Project: CPL - Common Portability Library 00005 * Purpose: Declarations for MiniXML Handler. 00006 * Author: Frank Warmerdam, warmerdam@pobox.com 00007 * 00008 ********************************************************************** 00009 * Copyright (c) 2001, Frank Warmerdam 00010 * 00011 * Permission is hereby granted, free of charge, to any person obtaining a 00012 * copy of this software and associated documentation files (the "Software"), 00013 * to deal in the Software without restriction, including without limitation 00014 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00015 * and/or sell copies of the Software, and to permit persons to whom the 00016 * Software is furnished to do so, subject to the following conditions: 00017 * 00018 * The above copyright notice and this permission notice shall be included 00019 * in all copies or substantial portions of the Software. 00020 * 00021 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00022 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00023 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00024 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00025 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00026 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00027 * DEALINGS IN THE SOFTWARE. 00028 ********************************************************************** 00029 * 00030 * $Log: cpl_minixml.h,v $ 00031 * Revision 1.8 2003/03/27 18:12:41 warmerda 00032 * Added NULL pszNameSpace support in namespace stripper (all namespaces). 00033 * Added XML file read/write functions. 00034 * 00035 * Revision 1.7 2003/03/24 16:46:48 warmerda 00036 * added CPLStripXMLNamespace 00037 * 00038 * Revision 1.6 2002/11/16 20:38:34 warmerda 00039 * added support for literals like DOCTYPE 00040 * 00041 * Revision 1.5 2002/05/24 04:09:10 warmerda 00042 * added clone and SetXMLValue functions 00043 * 00044 * Revision 1.4 2002/03/05 14:26:57 warmerda 00045 * expanded tabs 00046 * 00047 * Revision 1.3 2002/01/23 20:45:06 warmerda 00048 * handle <?...?> and comment elements 00049 * 00050 * Revision 1.2 2001/12/06 18:13:49 warmerda 00051 * added CPLAddXMLChild and CPLCreateElmentAndValue 00052 * 00053 * Revision 1.1 2001/11/16 15:39:48 warmerda 00054 * New 00055 * 00056 **********************************************************************/ 00057 00058 #ifndef _CPL_MINIXML_H_INCLUDED 00059 #define _CPL_MINIXML_H_INCLUDED 00060 00061 #include "cpl_port.h" 00062 00063 CPL_C_START 00064 00065 typedef enum 00066 { 00067 CXT_Element = 0, 00068 CXT_Text = 1, 00069 CXT_Attribute = 2, 00070 CXT_Comment = 3, 00071 CXT_Literal = 4 00072 } CPLXMLNodeType; 00073 00074 typedef struct _CPLXMLNode 00075 { 00076 CPLXMLNodeType eType; 00077 00078 char *pszValue; 00079 00080 struct _CPLXMLNode *psNext; 00081 struct _CPLXMLNode *psChild; 00082 } CPLXMLNode; 00083 00084 00085 CPLXMLNode CPL_DLL *CPLParseXMLString( const char * ); 00086 void CPL_DLL CPLDestroyXMLNode( CPLXMLNode * ); 00087 CPLXMLNode CPL_DLL *CPLGetXMLNode( CPLXMLNode *poRoot, 00088 const char *pszPath ); 00089 const char CPL_DLL *CPLGetXMLValue( CPLXMLNode *poRoot, 00090 const char *pszPath, 00091 const char *pszDefault ); 00092 CPLXMLNode CPL_DLL *CPLCreateXMLNode( CPLXMLNode *poParent, 00093 CPLXMLNodeType eType, 00094 const char *pszText ); 00095 char CPL_DLL *CPLSerializeXMLTree( CPLXMLNode *psNode ); 00096 void CPL_DLL CPLAddXMLChild( CPLXMLNode *psParent, 00097 CPLXMLNode *psChild ); 00098 CPLXMLNode CPL_DLL *CPLCreateXMLElementAndValue( CPLXMLNode *psParent, 00099 const char *pszName, 00100 const char *pszValue ); 00101 CPLXMLNode CPL_DLL *CPLCloneXMLTree( CPLXMLNode *psTree ); 00102 int CPL_DLL CPLSetXMLValue( CPLXMLNode *psRoot, const char *pszPath, 00103 const char *pszValue ); 00104 void CPL_DLL CPLStripXMLNamespace( CPLXMLNode *psRoot, 00105 const char *pszNameSpace, 00106 int bRecurse ); 00107 00108 CPLXMLNode CPL_DLL *CPLParseXMLFile( const char *pszFilename ); 00109 int CPL_DLL CPLSerializeXMLTreeToFile( CPLXMLNode *psTree, 00110 const char *pszFilename ); 00111 00112 CPL_C_END 00113 00114 #endif /* _CPL_MINIXML_H_INCLUDED */
1.2.14 written by Dimitri van Heesch,
© 1997-2002