Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Dom.h

Go to the documentation of this file.
00001 // $Header: /nfs/slac/g/glast/ground/cvs/xml/xml/Dom.h,v 1.12 2001/09/24 23:18:52 jrb Exp $
00002 // Author:  J. Bogart
00003 
00004 #ifndef XML_DOM_H
00005 #define XML_DOM_H
00006 
00007 class DOM_Element;
00008 class DOM_NodeList;
00009 class DOMString;
00010 class DOM_Node;
00011 class XMLLCPTranscoder;
00012 #include "util/XercesDefs.hpp"
00013 #include <string>
00014 #include <iostream>
00015 
00016 
00017 namespace xml {
00021   class Dom {
00022   public: 
00030     static DOM_Element  findFirstChildByName(const DOM_Element& parent, 
00031                                              const char* const name);
00032     static DOM_Element  findFirstChildByName(const DOM_Element& parent, 
00033                                              const std::string name);
00034 
00036 
00039     static DOM_Element  getSiblingElement(const DOM_Node& child);
00040 
00042     static DOM_Element  getFirstChildElement(const DOM_Node& parent);
00043 
00046     static std::string  getAttribute(const DOM_Element& elt, 
00047                                      char* attName);
00050     static std::string  getAttribute(const DOM_Element& elt, 
00051                                      std::string attName);
00052 
00056     static std::string  getAttribute(const DOM_Node& elt, 
00057                                      char* attName);
00061     static std::string  getAttribute(const DOM_Node& elt, 
00062                                      std::string attName);
00063 
00065     static void         addAttribute(DOM_Element& elt, const DOMString& name, 
00066                                      double value);
00067 
00069     static void         addAttribute(DOM_Element& elt, std::string name, 
00070                                      double value);
00071 
00073     static void addAttribute(DOM_Element& elt, const char * const name, 
00074                              double value)
00075       {addAttribute(elt, std::string(name), value);}
00076 
00078     static void         addAttribute(DOM_Element& elt, std::string name, 
00079                                      int value);
00080 
00082     static void addAttribute(DOM_Element& elt, const char * const name, 
00083                              int value)
00084       {addAttribute(elt, std::string(name), value);}
00085 
00087     static void         addAttribute(DOM_Element& elt, std::string name, 
00088                                      unsigned int value);
00089 
00092     static void addAttribute(DOM_Element& elt,  const char * const name, 
00093                              unsigned int value)
00094       {addAttribute(elt, std::string(name), value);}
00095 
00097     static void         addAttribute(DOM_Element& elt, std::string name, 
00098                                      std::string value);
00100     static void         addAttribute(DOM_Element& elt, std::string name, 
00101                                      const char * const value);
00102 
00103     
00104 
00105     // Could get rid of prefix argument for non-pretty print
00108     /*! To output an entire document, invoke this routine with
00109         the document element as first argument.
00110 
00111         This routine works best for DOM representations which
00112         already include formatting (end-of-lines and indentation).
00113     */
00114     static void         printElement(DOM_Node& elt, std::ostream& out);
00115 
00118 
00124     static void         prettyPrintElement(DOM_Node& elt, std::ostream& out,
00125                                            std::string prefix);
00126 
00129     static void         prune(DOM_Element elt);
00130 
00132 
00134     static char*        transToChar(DOMString str);
00135     static char*        transToChar(const XMLCh* const str, int len);
00136     static XMLCh*       transToXMLCh(const char* const src);
00137   private:
00138     static int          transBufSize;
00139     static char*        transBuf; /*< output buffer for \b transToChar */
00140     static int          xmlchBufSize;
00141     static XMLCh*       xmlchBuf; /*< output buffer for \b transToXMLCh */
00142     static XMLLCPTranscoder* transcoder;
00143     static int          initTrans(); /*< set up buffers, make transcoder */
00144 
00145 
00146   };
00147 } // end namespace
00148 #endif

Generated at Wed Nov 21 12:22:26 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000