00001 /* 00002 * Copyright (C) 2001-2003 Peter J Jones (pjones@pmade.org) 00003 * All Rights Reserved 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions 00007 * are met: 00008 * 00009 * 1. Redistributions of source code must retain the above copyright 00010 * notice, this list of conditions and the following disclaimer. 00011 * 2. Redistributions in binary form must reproduce the above copyright 00012 * notice, this list of conditions and the following disclaimer in 00013 * the documentation and/or other materials provided with the 00014 * distribution. 00015 * 3. Neither the name of the Author nor the names of its contributors 00016 * may be used to endorse or promote products derived from this software 00017 * without specific prior written permission. 00018 * 00019 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' 00020 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 00021 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 00022 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 00023 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00024 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00025 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 00026 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 00027 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00028 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00029 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00030 * SUCH DAMAGE. 00031 */ 00032 00033 /** @file 00034 * This file contains the definition of the xml::init class. 00035 **/ 00036 00037 #ifndef _xmlwrapp_init_h_ 00038 #define _xmlwrapp_init_h_ 00039 00040 namespace xml { 00041 00042 /** 00043 * The xml::init class is used to initilize the XML parser. For thread 00044 * safety it should be instantiated one time in the main thread before any 00045 * other threads use xmlwrapp. Non-threaded programs should instantiante a 00046 * xml::init class before using xmlwrapp as well, at least for 00047 * consistanticy. 00048 * 00049 * If you want to use and of the xml::init member functions, do so before 00050 * you start any threads or use any other part of xmlwrapp. The member 00051 * functions may alter global and/or static variables. In other words, this 00052 * class is not thread safe. 00053 **/ 00054 class init { 00055 public: 00056 //#################################################################### 00057 /** 00058 * Create a new xml::init object. This constructor will prepare the XML 00059 * parser and set some default values for the parsers global variables. 00060 * 00061 * @author Peter Jones 00062 **/ 00063 //#################################################################### 00064 init (void); 00065 00066 //#################################################################### 00067 /** 00068 * Clean up the XML parser. Don't let the xml::init object go out of 00069 * scope before you are done using the xmlwrapp library! 00070 * 00071 * @author Peter Jones 00072 **/ 00073 //#################################################################### 00074 virtual ~init (void); 00075 00076 //#################################################################### 00077 /** 00078 * This member function controls whether or not the XML parser should 00079 * add text nodes for indenting when generating XML text output from a 00080 * node tree. The default, set in the xml::init constructor, is true. 00081 * 00082 * @param flag True to turn on indenting, false to turn it off. 00083 * @author Peter Jones 00084 **/ 00085 //#################################################################### 00086 void indent_output (bool flag); 00087 00088 //#################################################################### 00089 /** 00090 * This member function controls whether or not the XML parser should 00091 * remove ignorable whitespace around XML elements. The default, set in 00092 * the xml::init constructor, is false. 00093 * 00094 * @param flag True to remove whitespace, false to leave alone. 00095 * @author Peter Jones 00096 **/ 00097 //#################################################################### 00098 void remove_whitespace (bool flag); 00099 00100 //#################################################################### 00101 /** 00102 * This member function controls whether or not the XML parser should 00103 * substitute entities while parsing. The default, set in the xml::init 00104 * constructor, is true. 00105 * 00106 * @param flag True to turn on substitution, false to turn off. 00107 * @author Peter Jones 00108 **/ 00109 //#################################################################### 00110 void substitute_entities (bool flag); 00111 00112 //#################################################################### 00113 /** 00114 * This member function controls whether or not the XML parser should 00115 * load external (DTD) subsets while parsing. This will only affect the 00116 * loading of the subsets, it does not cause files to be validated. The 00117 * default, set in the xml::init constructor, is true. 00118 * 00119 * @param flag True to turn on loading, flase to turn it off. 00120 * @author Peter Jones 00121 **/ 00122 //#################################################################### 00123 void load_external_subsets (bool flag); 00124 00125 //#################################################################### 00126 /** 00127 * This member function controls whether or not the XML parser should 00128 * validate every XML document that is parses with its DTD. The default, 00129 * set in the xml::init constructor, is false. 00130 * 00131 * @return flag True to turn on validation, false to turn it off. 00132 * @author Peter Jones 00133 **/ 00134 //#################################################################### 00135 void validate_xml (bool flag); 00136 00137 private: 00138 init (const init&); 00139 init& operator= (const init&); 00140 }; // end xml::init class 00141 00142 } // end xml namespace 00143 #endif