Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

psXML.h

Go to the documentation of this file.
00001 /** @file  psXML.h
00002  *
00003  *  @brief Contains basic XML definitions and operations
00004  *
00005  *  This file defines the basic type for an XML struct and functions useful
00006  *  in creation and usage of XML documents/files.
00007  *
00008  *  @ingroup XML
00009  *
00010  *  @author David Robbins, MHPCC
00011  *
00012  *  @version $Revision: 1.1.1.1 $ $Name:  $
00013  *  @date $Date: 2005/09/14 20:42:48 $
00014  *
00015  *  Copyright 2005 Maui High Performance Computing Center, University of Hawaii
00016  */
00017 
00018 #ifndef PS_XML_H
00019 #define PS_XML_H
00020 
00021 #include <libxml/parser.h>
00022 //#include <libxml/tree.h>
00023 #include <string.h>
00024 #include <ctype.h>
00025 #include <limits.h>
00026 
00027 #include "psMetadata.h"
00028 #include "psMetadataConfig.h"
00029 #include "psMemory.h"
00030 #include "psError.h"
00031 #include "psString.h"
00032 #include "psConstants.h"
00033 #include "psTime.h"
00034 #include "psErrorText.h"
00035 
00036 
00037 /// @addtogroup XML
00038 /// @{
00039 
00040 /** XML wrapper pointing to an XML document in memory */
00041 typedef xmlDocPtr psXMLDoc;
00042 
00043 
00044 /*****************************************************************************/
00045 
00046 /* FUNCTION PROTOTYPES                                                       */
00047 
00048 /*****************************************************************************/
00049 
00050 /** Allocates a new psXMLDoc
00051  *
00052  *  @return psXMLDoc*         a new psXMLDoc object
00053 */
00054 psXMLDoc *psXMLDocAlloc(void);
00055 
00056 /** Converts a psMetadata data structure to a complete psXMLDoc (in memory)
00057  *
00058  *  @return psXMLDoc*           Pointer to XML document from read
00059 */
00060 psXMLDoc *psMetadataToXMLDoc(
00061     const psMetadata *md               ///< psMetadata structure to read
00062 );
00063 
00064 /** Converts a complete psXMLDoc (in memory) to a psMetadata data structure
00065  *
00066  *  @return psMetadata*         Pointer to psMetadata data structure from read
00067 */
00068 psMetadata *psXMLDocToMetadata(
00069     const psXMLDoc *doc                ///< psXMLDoc to read
00070 );
00071 
00072 /** Loads the data in a named file into a complete psXMLDoc (in memory)
00073  *
00074  *  @return psXMLDoc*       Pointer to resulting XML document from read
00075 */
00076 psXMLDoc *psXMLParseFile(
00077     const char *filename               ///< Filename of file to be read
00078 );
00079 
00080 /** Writes out a complete psXMLDoc (in memory) to a named file
00081  *
00082  *  @return bool:       True on success or false otherwise.
00083 */
00084 bool psXMLDocToFile(
00085     const psXMLDoc *doc,               ///< psXMLDoc to read
00086     const char *filename               ///< Filename of file to be written
00087 );
00088 
00089 /** Accepts a block of memory and parses it into a complete psXMLDoc (also in memory)
00090  *
00091  *  @return psXMLDoc*       Pointer to resulting XML document from read
00092 */
00093 psXMLDoc *psXMLParseMem(
00094     const char *buffer,                ///< Buffer to read
00095     int size                           ///< Size of buffer
00096 );
00097 
00098 /** Accepts a complete psXMLDoc (in memory) and parses it into a block of memory
00099  *
00100  *  @return bool:       True on success or false otherwise.
00101 */
00102 bool psXMLDocToMem(
00103     const psXMLDoc *doc,               ///< psXMLDoc to read
00104     char *buffer                       ///< Buffer to write
00105 );
00106 
00107 /** Reads from a file descriptor and converts the incoming data to a complete
00108  *  psXMLDoc (in memory)
00109  *
00110  *  @return psXMLDoc*      Pointer to resulting XML document from read
00111 */
00112 psXMLDoc *psXMLParseFD(
00113     int fd                             ///< File descriptor to read
00114 );
00115 
00116 /** Reads from a complete psXMLDoc (in memory) and writes it to a file descriptor
00117  *
00118  *  @return bool:       True on success or false otherwise.
00119 */
00120 bool psXMLDocToFD(
00121     const psXMLDoc *doc,               ///< psXMLDoc to read
00122     int fd                             ///< File descriptor to write
00123 );
00124 
00125 /// @}
00126 
00127 #endif // #ifndef PS_XML_H
00128 

Generated on Wed Sep 14 10:42:48 2005 for Pan-STARRS Foundation Library by  doxygen 1.4.2