Main MRPT website > C++ reference for MRPT 1.9.9
xmlParser.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 /*! \mainpage XMLParser library
10  * \section intro_sec Introduction
11  *
12  * This is a basic XML parser written in ANSI C++ for portability.
13  * It works by using recursion and a node tree for breaking
14  * down the elements of an XML document.
15 
16  * Copyright (c) 2002, Frank Vanden Berghen
17  * All rights reserved.
18  *
19  * The following license terms apply to projects that are in some way related to
20  * the "The Mobile Robot Programming Toolkit (MRPT)" project, including
21  applications
22  * using "The Mobile Robot Programming Toolkit (MRPT)" and tools developed
23  * for enhancing "The Mobile Robot Programming Toolkit (MRPT)". All other
24  projects
25  * (not related to "The Mobile Robot Programming Toolkit (MRPT)") have to use
26  this
27  * code under the Aladdin Free Public License (AFPL)
28  * See the file "AFPL-license.txt" for more information about the AFPL license.
29  * (see http://www.artifex.com/downloads/doc/Public.htm for detailed AFPL terms)
30  *
31  * Redistribution and use in source and binary forms, with or without
32  * modification, are permitted provided that the following conditions are met:
33  * * Redistributions of source code must retain the above copyright
34  * notice, this list of conditions and the following disclaimer.
35  * * Redistributions in binary form must reproduce the above copyright
36  * notice, this list of conditions and the following disclaimer in the
37  * documentation and/or other materials provided with the distribution.
38  * * Neither the name of Frank Vanden Berghen nor the
39  * names of its contributors may be used to endorse or promote products
40  * derived from this software without specific prior written permission.
41  *
42  * THIS SOFTWARE IS PROVIDED BY Frank Vanden Berghen ``AS IS'' AND ANY
43  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
44  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
45  * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
46  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
47  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
48  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
49  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
50  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
51  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
52  *
53  * @version V2.39
54  * @author Frank Vanden Berghen
55  *
56  * \section tutorial First Tutorial
57  * You can follow a simple <a href="../../xmlParser.html">Tutorial</a> to know
58  the basics...
59  *
60  * \section usage General usage: How to include the XMLParser library inside
61  your project.
62  *
63  * The library is composed of two files: <a
64  href="../../xmlParser.cpp">xmlParser.cpp</a> and
65  * <a href="../../xmlParser.h">xmlParser.h</a>. These are the ONLY 2 files that
66  you need when
67  * using the library inside your own projects.
68  *
69  * All the functions of the library are documented inside the comments of the
70  file
71  * <a href="../../xmlParser.h">xmlParser.h</a>. These comments can be
72  transformed in
73  * full-fledged HTML documentation using the DOXYGEN software: simply type:
74  "doxygen doxy.cfg"
75  *
76  * By default, the XMLParser library uses (char*) for string representation.To
77  use the (wchar_t*)
78  * version of the library, you need to define the "_UNICODE" preprocessor
79  definition variable
80  * (this is usually done inside your project definition file) (This is done
81  automatically for you
82  * when using Visual Studio).
83  *
84  * \section example Advanced Tutorial and Many Examples of usage.
85  *
86  * Some very small introductory examples are described inside the Tutorial file
87  * <a href="../../xmlParser.html">xmlParser.html</a>
88  *
89  * Some additional small examples are also inside the file <a
90  href="../../xmlTest.cpp">xmlTest.cpp</a>
91  * (for the "char*" version of the library) and inside the file
92  * <a href="../../xmlTestUnicode.cpp">xmlTestUnicode.cpp</a> (for the "wchar_t*"
93  * version of the library). If you have a question, please review these
94  additionnal examples
95  * before sending an e-mail to the author.
96  *
97  * To build the examples:
98  * - linux/unix: type "make"
99  * - solaris: type "make -f makefile.solaris"
100  * - windows: Visual Studio: double-click on xmlParser.dsw
101  * (under Visual Studio .NET, the .dsp and .dsw files will be automatically
102  converted to .vcproj and .sln files)
103  *
104  * In order to build the examples you need some additional files:
105  * - linux/unix: makefile
106  * - solaris: makefile.solaris
107  * - windows: Visual Studio: *.dsp, xmlParser.dsw and also xmlParser.lib and
108  xmlParser.dll
109  *
110  * \section debugging Debugging with the XMLParser library
111  *
112  * \subsection debugwin Debugging under WINDOWS
113  *
114  * Inside Visual C++, the "debug versions" of the memory allocation functions
115  are
116  * very slow: Do not forget to compile in "release mode" to get maximum speed.
117  * When I have to debug a software that is using the XMLParser Library, it
118  was usually
119  * a nightmare because the library was sooOOOoooo slow in debug mode (because
120  of the
121  * slow memory allocations in Debug mode). To solve this
122  * problem, during all the debugging session, I use a very fast DLL version
123  of the
124  * XMLParser Library (the DLL is compiled in release mode). Using the DLL
125  version of
126  * the XMLParser Library allows me to have lightening XML parsing speed even
127  in debug!
128  * Other than that, the DLL version is useless: In the release version of my
129  tool,
130  * I always use the normal, ".cpp"-based, XMLParser Library (I simply include
131  the
132  * <a href="../../xmlParser.cpp">xmlParser.cpp</a> and
133  * <a href="../../xmlParser.h">xmlParser.h</a> files into the project).
134  *
135  * The file <a href="../../XMLNodeAutoexp.txt">XMLNodeAutoexp.txt</a>
136  contains some
137  * "tweaks" that improve substancially the display of the content of the XMLNode
138  objects
139  * inside the Visual Studio Debugger. Believe me, once you have seen inside the
140  debugger
141  * the "smooth" display of the XMLNode objects, you cannot live without it
142  anymore!
143  *
144  * \subsection debuglinux Debugging under LINUX/UNIX
145  *
146  * The speed of the debug version of the XMLParser library is tolerable so no
147  extra
148  * work.has been done.
149  *
150  ****************************************************************************/
151 
152 #ifndef __INCLUDE_XML_NODE__
153 #define __INCLUDE_XML_NODE__
154 
155 #include <cstdlib>
156 
157 #ifdef _UNICODE
158 // If you comment the next "define" line then the library will never "switch to"
159 // _UNICODE (wchar_t*) mode (16/32 bits per characters).
160 // This is useful when you get error messages like:
161 // 'XMLNode::openFileHelper' : cannot convert parameter 2 from 'const char
162 // [5]' to 'const wchar_t *'
163 // The _XMLWIDECHAR preprocessor variable force the XMLParser library into
164 // either utf16/32-mode (the proprocessor variable
165 // must be defined) or utf8-mode(the pre-processor variable must be undefined).
166 #define _XMLWIDECHAR
167 #endif
168 
169 #if defined(WIN32) || defined(UNDER_CE) || defined(_WIN32) || \
170  defined(WIN64) || defined(__BORLANDC__)
171 // comment the next line if you are under windows and the compiler is not
172 // Microsoft Visual Studio (6.0 or .NET) or Borland
173 #define _XMLWINDOWS
174 #endif
175 
176 #ifdef XMLDLLENTRY
177 #undef XMLDLLENTRY
178 #endif
179 #ifdef _USE_XMLPARSER_DLL
180 #ifdef _DLL_EXPORTS_
181 #define XMLDLLENTRY __declspec(dllexport)
182 #else
183 #define XMLDLLENTRY __declspec(dllimport)
184 #endif
185 #else
186 #define XMLDLLENTRY
187 #endif
188 
189 // uncomment the next line if you want no support for wchar_t* (no need for the
190 // <wchar.h> or <tchar.h> libraries anymore to compile)
191 //#define XML_NO_WIDE_CHAR
192 
193 // Mod. JLBC
194 #ifdef __BORLANDC__
195 #define XML_NO_WIDE_CHAR
196 #define strcasecmp(a, b) stricmp(a, b)
197 #define strncasecmp(a, b, c) _strnicmp(a, b, c)
198 #define _timeb timeb
199 #define _ftime(a) ftime(a)
200 #define _strnicmp(a, b, c) strnicmp(a, b, c)
201 #define _errno errno #endif
202 #endif
203 
204 #ifdef XML_NO_WIDE_CHAR
205 #undef _XMLWINDOWS
206 #undef _XMLWIDECHAR
207 #endif
208 
209 #ifdef _XMLWINDOWS
210 #include <tchar.h>
211 #else
212 #define XMLDLLENTRY
213 #ifndef XML_NO_WIDE_CHAR
214 #include <wchar.h> // to have 'wcsrtombs' for ANSI version
215 // to have 'mbsrtowcs' for WIDECHAR version
216 #endif
217 #endif
218 
219 // Some common types for char set portable code
220 #ifdef _XMLWIDECHAR
221 #define _CXML(c) L##c
222 #define XMLCSTR const wchar_t*
223 #define XMLSTR wchar_t*
224 #define XMLCHAR wchar_t
225 #else
226 #define _CXML(c) c
227 #define XMLCSTR const char*
228 #define XMLSTR char*
229 #define XMLCHAR char
230 #endif
231 #ifndef FALSE
232 #define FALSE 0
233 #endif /* FALSE */
234 #ifndef TRUE
235 #define TRUE 1
236 #endif /* TRUE */
237 
238 /// Enumeration for XML parse errors.
239 typedef enum XMLError {
257 
262 } XMLError;
263 
264 /// Enumeration used to manage type of data. Use in conjunction with structure
265 /// XMLNodeContents
266 typedef enum XMLElementType {
273 
274 /// Structure used to obtain error details if the parse fails.
275 typedef struct XMLResults
276 {
279 } XMLResults;
280 
281 /// Structure for XML clear (unformatted) node (usually comments)
282 typedef struct XMLClear
283 {
287 } XMLClear;
288 
289 /// Structure for XML attribute.
290 typedef struct XMLAttribute
291 {
294 } XMLAttribute;
295 
296 /// XMLElementPosition are not interchangeable with simple indexes
297 typedef int XMLElementPosition;
298 
299 struct XMLNodeContents;
300 
301 /** @defgroup XMLParserGeneral The XML parser */
302 
303 /// Main Class representing a XML node
304 /**
305  * All operations are performed using this class.
306  * \note The constructors of the XMLNode class are protected, so use instead one
307  * of these four methods to get your first instance of XMLNode:
308  * <ul>
309  * <li> XMLNode::parseString </li>
310  * <li> XMLNode::parseFile </li>
311  * <li> XMLNode::openFileHelper </li>
312  * <li> XMLNode::createXMLTopNode (or XMLNode::createXMLTopNode_WOSD)</li>
313  * </ul> */
314 typedef struct XMLDLLENTRY XMLNode
315 {
316  private:
317  struct XMLNodeDataTag;
318 
319  /// Constructors are protected, so use instead one of: XMLNode::parseString,
320  /// XMLNode::parseFile, XMLNode::openFileHelper, XMLNode::createXMLTopNode
321  XMLNode(
322  struct XMLNodeDataTag* pParent, XMLSTR lpszName, char isDeclaration);
323  /// Constructors are protected, so use instead one of: XMLNode::parseString,
324  /// XMLNode::parseFile, XMLNode::openFileHelper, XMLNode::createXMLTopNode
325  XMLNode(struct XMLNodeDataTag* p);
326 
327  public:
328  static XMLCSTR
329  getVersion(); ///< Return the XMLParser library version number
330 
331  /** @defgroup conversions Parsing XML files/strings to an XMLNode structure
332  * and Rendering XMLNode's to files/string.
333  * @ingroup XMLParserGeneral
334  * @{ */
335 
336  /// Parse an XML string and return the root of a XMLNode tree representing
337  /// the string.
338  static XMLNode parseString(
339  XMLCSTR lpXMLString, XMLCSTR tag = nullptr,
340  XMLResults* pResults = nullptr);
341  /**< The "parseString" function parse an XML string and return the root of a
342  * XMLNode tree. The "opposite" of this function is
343  * the function "createXMLString" that re-creates an XML string from an
344  * XMLNode tree. If the XML document is corrupted, the
345  * "parseString" method will initialize the "pResults" variable with some
346  * information that can be used to trace the error.
347  * If you still want to parse the file, you can use the APPROXIMATE_PARSING
348  * option as explained inside the note at the
349  * beginning of the "xmlParser.cpp" file.
350  *
351  * @param lpXMLString the XML string to parse
352  * @param tag the name of the first tag inside the XML file. If the tag
353  * parameter is omitted, this function returns a node that represents the
354  * head of the xml document including the declaration term (<? ... ?>).
355  * @param pResults a pointer to a XMLResults variable that will contain some
356  * information that can be used to trace the XML parsing error. You can have
357  * a user-friendly explanation of the parsing error with the "getError"
358  * function.
359  */
360 
361  /// Parse an XML file and return the root of a XMLNode tree representing the
362  /// file.
363  static XMLNode parseFile(
364  XMLCSTR filename, XMLCSTR tag = nullptr,
365  XMLResults* pResults = nullptr);
366  /**< The "parseFile" function parse an XML file and return the root of a
367  * XMLNode tree. The "opposite" of this function is
368  * the function "writeToFile" that re-creates an XML file from an XMLNode
369  * tree. If the XML document is corrupted, the
370  * "parseFile" method will initialize the "pResults" variable with some
371  * information that can be used to trace the error.
372  * If you still want to parse the file, you can use the APPROXIMATE_PARSING
373  * option as explained inside the note at the
374  * beginning of the "xmlParser.cpp" file.
375  *
376  * @param filename the path to the XML file to parse
377  * @param tag the name of the first tag inside the XML file. If the tag
378  * parameter is omitted, this function returns a node that represents the
379  * head of the xml document including the declaration term (<? ... ?>).
380  * @param pResults a pointer to a XMLResults variable that will contain some
381  * information that can be used to trace the XML parsing error. You can have
382  * a user-friendly explanation of the parsing error with the "getError"
383  * function.
384  */
385 
386  /// Parse an XML file and return the root of a XMLNode tree representing the
387  /// file. A very crude error checking is made. An attempt to guess the Char
388  /// Encoding used in the file is made.
389  static XMLNode openFileHelper(XMLCSTR filename, XMLCSTR tag = nullptr);
390  /**< The "openFileHelper" function reports to the screen all the warnings
391  * and errors that occurred during parsing of the XML file.
392  * This function also tries to guess char Encoding (UTF-8, ASCII or
393  * SHIT-JIS) based on the first 200 bytes of the file. Since each
394  * application has its own way to report and deal with errors, you should
395  * rather use the "parseFile" function to parse XML files
396  * and program yourself thereafter an "error reporting" tailored for your
397  * needs (instead of using the very crude "error reporting"
398  * mechanism included inside the "openFileHelper" function).
399  *
400  * If the XML document is corrupted, the "openFileHelper" method will:
401  * - display an error message on the console (or inside a messageBox
402  * for windows).
403  * - stop execution (exit).
404  *
405  * I strongly suggest that you write your own "openFileHelper" method
406  * tailored to your needs. If you still want to parse
407  * the file, you can use the APPROXIMATE_PARSING option as explained inside
408  * the note at the beginning of the "xmlParser.cpp" file.
409  *
410  * @param filename the path of the XML file to parse.
411  * @param tag the name of the first tag inside the XML file. If the tag
412  * parameter is omitted, this function returns a node that represents the
413  * head of the xml document including the declaration term (<? ... ?>).
414  */
415 
416  static XMLCSTR getError(XMLError error); ///< this gives you a
417  /// user-friendly explanation of
418  /// the parsing error
419 
420  /// Create an XML string starting from the current XMLNode.
421  XMLSTR createXMLString(int nFormat = 1, int* pnSize = nullptr) const;
422  /**< The returned string should be free'd using the "freeXMLString"
423  * function.
424  *
425  * If nFormat==0, no formatting is required otherwise this returns an user
426  * friendly XML string from a given element
427  * with appropriate white spaces and carriage returns. if pnSize is given
428  * it returns the size in character of the string. */
429 
430  /// Save the content of an xmlNode inside a file
431  XMLError writeToFile(
432  XMLCSTR filename, const char* encoding = nullptr,
433  char nFormat = 1) const;
434  /**< If nFormat==0, no formatting is required otherwise this returns an user
435  * friendly XML string from a given element with appropriate white spaces
436  * and carriage returns.
437  * If the global parameter "characterEncoding==encoding_UTF8", then the
438  * "encoding" parameter is ignored and always set to "utf-8".
439  * If the global parameter "characterEncoding==encoding_ShiftJIS", then the
440  * "encoding" parameter is ignored and always set to "SHIFT-JIS".
441  * If "_XMLWIDECHAR=1", then the "encoding" parameter is ignored and always
442  * set to "utf-16".
443  * If no "encoding" parameter is given the "ISO-8859-1" encoding is used. */
444  /** @} */
445 
446  /** @defgroup navigate Navigate the XMLNode structure
447  * @ingroup XMLParserGeneral
448  * @{ */
449  XMLCSTR getName() const; ///< name of the node
450  XMLCSTR getText(int i = 0) const; ///< return ith text field
451  int nText() const; ///< nbr of text field
452  XMLNode getParentNode() const; ///< return the parent node
453  XMLNode getChildNode(int i = 0) const; ///< return ith child node
454  XMLNode getChildNode(XMLCSTR name, int i) const; ///< return ith child node
455  /// with specific name
456  ///(return an empty node
457  /// if failing). If i==-1,
458  /// this returns the last
459  /// XMLNode with the given
460  /// name.
461  XMLNode getChildNode(XMLCSTR name, int* i = nullptr) const; ///< return
462  /// next child
463  /// node with
464  /// specific
465  /// name (return
466  /// an empty
467  /// node if
468  /// failing)
469  XMLNode getChildNodeWithAttribute(
470  XMLCSTR tagName, XMLCSTR attributeName,
471  XMLCSTR attributeValue = nullptr,
472  int* i = nullptr) const; ///< return child node with specific
473  /// name/attribute (return an empty node if
474  /// failing)
475  XMLNode getChildNodeByPath(
476  XMLSTR path, char createNodeIfMissing = 0, XMLCHAR sep = '/');
477  ///< return the first child node with specific path. WARNING: the value of
478  /// the parameter "path" is destroyed!
479  XMLNode getChildNodeByPath(
480  XMLCSTR path, char createNodeIfMissing = 0, XMLCHAR sep = '/');
481  ///< return the first child node with specific path
482 
483  int nChildNode(XMLCSTR name)
484  const; ///< return the number of child node with specific name
485  int nChildNode() const; ///< nbr of child node
486  XMLAttribute getAttribute(int i = 0) const; ///< return ith attribute
487  XMLCSTR getAttributeName(int i = 0) const; ///< return ith attribute name
488  XMLCSTR getAttributeValue(int i = 0) const; ///< return ith attribute value
489  char isAttributeSet(XMLCSTR name)
490  const; ///< test if an attribute with a specific name is given
491  XMLCSTR getAttribute(XMLCSTR name, int i) const; ///< return ith attribute
492  /// content with specific
493  /// name (return a nullptr
494  /// if failing)
495  XMLCSTR getAttribute(XMLCSTR name, int* i = nullptr) const; ///< return
496  /// next
497  /// attribute
498  /// content with
499  /// specific
500  /// name (return
501  /// a nullptr if
502  /// failing)
503  int nAttribute() const; ///< nbr of attribute
504  XMLClear getClear(int i = 0) const; ///< return ith clear field (comments)
505  int nClear() const; ///< nbr of clear field
506  XMLNodeContents enumContents(XMLElementPosition i)
507  const; ///< enumerate all the different contents (attribute,child,text,
508  /// clear) of the current XMLNode. The order is reflecting the
509  /// order of the original file/string. NOTE: 0 <= i < nElement();
510  int nElement() const; ///< nbr of different contents for current node
511  char isEmpty() const; ///< is this node Empty?
512  char isDeclaration() const; ///< is this node a declaration <? .... ?>
513  XMLNode deepCopy() const; ///< deep copy (duplicate/clone) a XMLNode
514  static XMLNode emptyNode(); ///< return XMLNode::emptyXMLNode;
515  /** @} */
516 
517  ~XMLNode();
518  XMLNode(const XMLNode& A); ///< to allow shallow/fast copy:
519  XMLNode& operator=(const XMLNode& A); ///< to allow shallow/fast copy:
520 
521  XMLNode() : d(nullptr){};
522  static XMLNode emptyXMLNode;
525 
526  /** @defgroup xmlModify Create or Update the XMLNode structure
527  * @ingroup XMLParserGeneral
528  * The functions in this group allows you to create from scratch (or
529  * update) a XMLNode structure. Start by creating your top
530  * node with the "createXMLTopNode" function and then add new nodes with
531  * the "addChild" function. The parameter 'pos' gives
532  * the position where the childNode, the text or the XMLClearTag will be
533  * inserted. The default value (pos=-1) inserts at the
534  * end. The value (pos=0) insert at the beginning (Insertion at the
535  * beginning is slower than at the end). <br>
536  *
537  * REMARK: 0 <= pos < nChild()+nText()+nClear() <br>
538  */
539 
540  /** @defgroup creation Creating from scratch a XMLNode structure
541  * @ingroup xmlModify
542  * @{ */
543  static XMLNode createXMLTopNode(
544  XMLCSTR lpszName,
545  char isDeclaration =
546  FALSE); ///< Create the top node of an XMLNode structure
547  XMLNode addChild(
548  XMLCSTR lpszName, char isDeclaration = FALSE,
549  XMLElementPosition pos = -1); ///< Add a new child node
550  XMLNode addChild(
551  XMLNode nodeToAdd,
552  XMLElementPosition pos = -1); ///< If the "nodeToAdd" has some parents,
553  /// it will be detached from it's parents
554  /// before being attached to the current
555  /// XMLNode
556  XMLAttribute* addAttribute(
557  XMLCSTR lpszName, XMLCSTR lpszValuev); ///< Add a new attribute
558  XMLCSTR addText(
559  XMLCSTR lpszValue,
560  XMLElementPosition pos = -1); ///< Add a new text content
561  XMLClear* addClear(
562  XMLCSTR lpszValue, XMLCSTR lpszOpen = nullptr,
563  XMLCSTR lpszClose = nullptr, XMLElementPosition pos = -1);
564  /**< Add a new clear tag
565  * @param lpszOpen default value "<![CDATA["
566  * @param lpszClose default value "]]>"
567  */
568  /** @} */
569 
570  /** @defgroup xmlUpdate Updating Nodes
571  * @ingroup xmlModify
572  * Some update functions:
573  * @{
574  */
575  XMLCSTR updateName(XMLCSTR lpszName); ///< change node's name
576  XMLAttribute* updateAttribute(
577  XMLAttribute* newAttribute,
578  XMLAttribute* oldAttribute); ///< if the attribute to update is
579  /// missing, a new one will be added
580  XMLAttribute* updateAttribute(
581  XMLCSTR lpszNewValue, XMLCSTR lpszNewName = nullptr,
582  int i = 0); ///< if the attribute to update is missing, a new one will
583  /// be added
584  XMLAttribute* updateAttribute(
585  XMLCSTR lpszNewValue, XMLCSTR lpszNewName,
586  XMLCSTR lpszOldName); ///< set lpszNewName=nullptr if you don't want to
587  /// change the name of the attribute if the
588  /// attribute to update is missing, a new one will
589  /// be added
590  XMLCSTR updateText(XMLCSTR lpszNewValue, int i = 0); ///< if the text to
591  /// update is missing,
592  /// a new one will be
593  /// added
594  XMLCSTR updateText(XMLCSTR lpszNewValue, XMLCSTR lpszOldValue); ///< if the
595  /// text to
596  /// update
597  /// is
598  /// missing,
599  /// a new
600  /// one will
601  /// be added
602  XMLClear* updateClear(XMLCSTR lpszNewContent, int i = 0); ///< if the
603  /// clearTag to
604  /// update is
605  /// missing, a new
606  /// one will be
607  /// added
608  XMLClear* updateClear(XMLClear* newP, XMLClear* oldP); ///< if the clearTag
609  /// to update is
610  /// missing, a new
611  /// one will be added
612  XMLClear* updateClear(
613  XMLCSTR lpszNewValue, XMLCSTR lpszOldValue); ///< if the clearTag to
614  /// update is missing, a
615  /// new one will be added
616  /** @} */
617 
618  /** @defgroup xmlDelete Deleting Nodes or Attributes
619  * @ingroup xmlModify
620  * Some deletion functions:
621  * @{
622  */
623  /// The "deleteNodeContent" function forces the deletion of the content of
624  /// this XMLNode and the subtree.
625  void deleteNodeContent();
626  /**< \note The XMLNode instances that are referring to the part of the
627  * subtree that has been deleted CANNOT be used anymore!!. Unexpected
628  * results will occur if you continue using them. */
629  void deleteAttribute(
630  int i = 0); ///< Delete the ith attribute of the current XMLNode
631  void deleteAttribute(XMLCSTR lpszName); ///< Delete the attribute with the
632  /// given name (the "strcmp"
633  /// function is used to find the
634  /// right attribute)
635  void deleteAttribute(XMLAttribute* anAttribute); ///< Delete the attribute
636  /// with the name
637  ///"anAttribute->lpszName"
638  ///(the "strcmp" function
639  /// is used to find the
640  /// right attribute)
641  void deleteText(
642  int i = 0); ///< Delete the Ith text content of the current XMLNode
643  void deleteText(XMLCSTR lpszValue); ///< Delete the text content
644  ///"lpszValue" inside the current
645  /// XMLNode (direct "pointer-to-pointer"
646  /// comparison is used to find the right
647  /// text)
648  void deleteClear(
649  int i = 0); ///< Delete the Ith clear tag inside the current XMLNode
650  void deleteClear(XMLCSTR lpszValue); ///< Delete the clear tag "lpszValue"
651  /// inside the current XMLNode (direct
652  ///"pointer-to-pointer" comparison is
653  /// used to find the clear tag)
654  void deleteClear(XMLClear* p); ///< Delete the clear tag "p" inside the
655  /// current XMLNode (direct
656  ///"pointer-to-pointer" comparison on the
657  /// lpszName of the clear tag is used to find
658  /// the clear tag)
659  /** @} */
660 
661  /** @defgroup xmlWOSD ???_WOSD functions.
662  * @ingroup xmlModify
663  * The strings given as parameters for the "add" and "update" methods that
664  * have a name with
665  * the postfix "_WOSD" (that means "WithOut String Duplication")(for
666  * example "addText_WOSD")
667  * will be free'd by the XMLNode class. For example, it means that this is
668  * incorrect:
669  * \code
670  * xNode.addText_WOSD("foo");
671  * xNode.updateAttribute_WOSD("#newcolor" ,nullptr,"color");
672  * \endcode
673  * In opposition, this is correct:
674  * \code
675  * xNode.addText("foo");
676  * xNode.addText_WOSD(stringDup("foo"));
677  * xNode.updateAttribute("#newcolor" ,nullptr,"color");
678  * xNode.updateAttribute_WOSD(stringDup("#newcolor"),nullptr,"color");
679  * \endcode
680  * Typically, you will never do:
681  * \code
682  * char *b=(char*)malloc(...);
683  * xNode.addText(b);
684  * free(b);
685  * \endcode
686  * ... but rather:
687  * \code
688  * char *b=(char*)malloc(...);
689  * xNode.addText_WOSD(b);
690  * \endcode
691  * ('free(b)' is performed by the XMLNode class)
692  * @{ */
693  static XMLNode createXMLTopNode_WOSD(
694  XMLSTR lpszName,
695  char isDeclaration =
696  FALSE); ///< Create the top node of an XMLNode structure
697  XMLNode addChild_WOSD(
698  XMLSTR lpszName, char isDeclaration = FALSE,
699  XMLElementPosition pos = -1); ///< Add a new child node
700  XMLAttribute* addAttribute_WOSD(
701  XMLSTR lpszName, XMLSTR lpszValue); ///< Add a new attribute
702  XMLCSTR addText_WOSD(
703  XMLSTR lpszValue,
704  XMLElementPosition pos = -1); ///< Add a new text content
705  XMLClear* addClear_WOSD(
706  XMLSTR lpszValue, XMLCSTR lpszOpen = nullptr,
707  XMLCSTR lpszClose = nullptr,
708  XMLElementPosition pos = -1); ///< Add a new clear Tag
709 
710  XMLCSTR updateName_WOSD(XMLSTR lpszName); ///< change node's name
711  XMLAttribute* updateAttribute_WOSD(
712  XMLAttribute* newAttribute,
713  XMLAttribute* oldAttribute); ///< if the attribute to update is
714  /// missing, a new one will be added
715  XMLAttribute* updateAttribute_WOSD(
716  XMLSTR lpszNewValue, XMLSTR lpszNewName = nullptr,
717  int i = 0); ///< if the attribute to update is missing, a new one will
718  /// be added
719  XMLAttribute* updateAttribute_WOSD(
720  XMLSTR lpszNewValue, XMLSTR lpszNewName,
721  XMLCSTR lpszOldName); ///< set lpszNewName=nullptr if you don't want to
722  /// change the name of the attribute if the
723  /// attribute to update is missing, a new one will
724  /// be added
725  XMLCSTR updateText_WOSD(
726  XMLSTR lpszNewValue,
727  int i =
728  0); ///< if the text to update is missing, a new one will be added
729  XMLCSTR updateText_WOSD(
730  XMLSTR lpszNewValue, XMLCSTR lpszOldValue); ///< if the text to update
731  /// is missing, a new one
732  /// will be added
733  XMLClear* updateClear_WOSD(XMLSTR lpszNewContent, int i = 0); ///< if the
734  /// clearTag
735  /// to update
736  /// is
737  /// missing, a
738  /// new one
739  /// will be
740  /// added
741  XMLClear* updateClear_WOSD(XMLClear* newP, XMLClear* oldP); ///< if the
742  /// clearTag to
743  /// update is
744  /// missing, a
745  /// new one will
746  /// be added
747  XMLClear* updateClear_WOSD(
748  XMLSTR lpszNewValue, XMLCSTR lpszOldValue); ///< if the clearTag to
749  /// update is missing, a new
750  /// one will be added
751  /** @} */
752 
753  /** @defgroup xmlPosition Position helper functions (use in conjunction with
754  * the update&add functions
755  * @ingroup xmlModify
756  * These are some useful functions when you want to insert a childNode, a
757  * text or a XMLClearTag in the
758  * middle (at a specified position) of a XMLNode tree already constructed.
759  * The value returned by these
760  * methods is to be used as last parameter (parameter 'pos') of addChild,
761  * addText or addClear.
762  * @{ */
763  XMLElementPosition positionOfText(int i = 0) const;
764  XMLElementPosition positionOfText(XMLCSTR lpszValue) const;
765  XMLElementPosition positionOfClear(int i = 0) const;
766  XMLElementPosition positionOfClear(XMLCSTR lpszValue) const;
767  XMLElementPosition positionOfClear(XMLClear* a) const;
768  XMLElementPosition positionOfChildNode(int i = 0) const;
769  XMLElementPosition positionOfChildNode(XMLNode x) const;
770  XMLElementPosition positionOfChildNode(
771  XMLCSTR name, int i = 0) const; ///< return the position of the ith
772  /// childNode with the specified name if
773  ///(name==nullptr) return the position
774  /// of the ith childNode
775  /** @} */
776 
777  /// Enumeration for XML character encoding.
778  typedef enum XMLCharEncoding {
779  char_encoding_error = 0,
780  char_encoding_UTF8 = 1,
781  char_encoding_legacy = 2,
782  char_encoding_ShiftJIS = 3,
783  char_encoding_GB2312 = 4,
784  char_encoding_Big5 = 5,
785  char_encoding_GBK = 6 // this is actually the same as Big5
786  } XMLCharEncoding;
787 
788  /** \addtogroup conversions
789  * @{ */
790 
791  /// Sets the global options for the conversions
792  static char setGlobalOptions(
794  char guessWideCharChars = 1, char dropWhiteSpace = 1,
796  /**< The "setGlobalOptions" function allows you to change four global
797  * parameters that affect string & file
798  * parsing. First of all, you most-probably will never have to change these
799  * 3 global parameters.
800  *
801  * @param guessWideCharChars If "guessWideCharChars"=1 and if this library
802  * is compiled in WideChar mode, then the
803  * XMLNode::parseFile and XMLNode::openFileHelper functions will test if
804  * the file contains ASCII
805  * characters. If this is the case, then the file will be loaded and
806  * converted in memory to
807  * WideChar before being parsed. If 0, no conversion will be performed.
808  *
809  * @param guessWideCharChars If "guessWideCharChars"=1 and if this library
810  * is compiled in ASCII/UTF8/char* mode, then the
811  * XMLNode::parseFile and XMLNode::openFileHelper functions will test if
812  * the file contains WideChar
813  * characters. If this is the case, then the file will be loaded and
814  * converted in memory to
815  * ASCII/UTF8/char* before being parsed. If 0, no conversion will be
816  * performed.
817  *
818  * @param characterEncoding This parameter is only meaningful when compiling
819  * in char* mode (multibyte character mode).
820  * In wchar_t* (wide char mode), this parameter is ignored. This
821  * parameter should be one of the
822  * three currently recognized encodings: XMLNode::encoding_UTF8,
823  * XMLNode::encoding_ascii,
824  * XMLNode::encoding_ShiftJIS.
825  *
826  * @param dropWhiteSpace In most situations, text fields containing only
827  * white spaces (and carriage returns)
828  * are useless. Even more, these "empty" text fields are annoying
829  * because they increase the
830  * complexity of the user's code for parsing. So, 99% of the time, it's
831  * better to drop
832  * the "empty" text fields. However The XML specification indicates that
833  * no white spaces
834  * should be lost when parsing the file. So to be perfectly
835  * XML-compliant, you should set
836  * dropWhiteSpace=0. A note of caution: if you set "dropWhiteSpace=0",
837  * the parser will be
838  * slower and your code will be more complex.
839  *
840  * @param removeCommentsInMiddleOfText To explain this parameter, let's
841  * consider this code:
842  * \code
843  * XMLNode x=XMLNode::parseString("<a>foo<!-- hello -->bar<!DOCTYPE
844  * world >chu</a>","a");
845  * \endcode
846  * If removeCommentsInMiddleOfText=0, then we will have:
847  * \code
848  * x.getText(0) -> "foo"
849  * x.getText(1) -> "bar"
850  * x.getText(2) -> "chu"
851  * x.getClear(0) --> "<!-- hello -->"
852  * x.getClear(1) --> "<!DOCTYPE world >"
853  * \endcode
854  * If removeCommentsInMiddleOfText=1, then we will have:
855  * \code
856  * x.getText(0) -> "foobar"
857  * x.getText(1) -> "chu"
858  * x.getClear(0) --> "<!DOCTYPE world >"
859  * \endcode
860  *
861  * \return "0" when there are no errors. If you try to set an unrecognized
862  * encoding then the return value will be "1" to signal an error.
863  *
864  * \note Sometime, it's useful to set "guessWideCharChars=0" to disable any
865  * conversion
866  * because the test to detect the file-type (ASCII/UTF8/char* or WideChar)
867  * may fail (rarely). */
868 
869  /// Guess the character encoding of the string (ascii, utf8 or shift-JIS)
870  static XMLCharEncoding guessCharEncoding(
871  void* buffer, int bufLen, char useXMLEncodingAttribute = 1);
872  /**< The "guessCharEncoding" function try to guess the character encoding.
873  * You most-probably will never
874  * have to use this function. It then returns the appropriate value of the
875  * global parameter
876  * "characterEncoding" described in the XMLNode::setGlobalOptions. The guess
877  * is based on the content of a buffer of length
878  * "bufLen" bytes that contains the first bytes (minimum 25 bytes; 200 bytes
879  * is a good value) of the
880  * file to be parsed. The XMLNode::openFileHelper function is using this
881  * function to automatically compute
882  * the value of the "characterEncoding" global parameter. There are several
883  * heuristics used to do the
884  * guess. One of the heuristic is based on the "encoding" attribute. The
885  * original XML specifications
886  * forbids to use this attribute to do the guess but you can still use it if
887  * you set
888  * "useXMLEncodingAttribute" to 1 (this is the default behavior and the
889  * behavior of most parsers).
890  * If an inconsistency in the encoding is detected, then the return value is
891  * "0". */
892  /** @} */
893 
894  private:
895  // these are functions and structures used internally by the XMLNode class
896  // (don't bother about them):
897 
898  typedef struct XMLNodeDataTag // to allow shallow copy and
899  // "intelligent/smart" pointers (automatic
900  // delete):
901  {
902  XMLCSTR lpszName; // Element name (=nullptr if root)
903  int nChild, // Number of child nodes
904  nText, // Number of text fields
905  nClear, // Number of Clear fields (comments)
906  nAttribute; // Number of attributes
907  char isDeclaration; // Whether node is an XML declaration - '<?xml ?>'
909  pParent; // Pointer to parent element (=nullptr if root)
910  XMLNode* pChild; // Array of child nodes
911  XMLCSTR* pText; // Array of text fields
912  XMLClear* pClear; // Array of clear fields
913  XMLAttribute* pAttribute; // Array of attributes
914  int* pOrder; // order of the child_nodes,text_fields,clear_fields
915  int ref_count; // for garbage collection (smart pointers)
916  } XMLNodeData;
918 
919  char parseClearTag(void* px, void* pa);
920  char maybeAddTxT(void* pa, XMLCSTR tokenPStr);
921  int ParseXMLElement(void* pXML);
922  void* addToOrder(
923  int memInc, int* _pos, int nc, void* p, int size, XMLElementType xtype);
924  int indexText(XMLCSTR lpszValue) const;
925  int indexClear(XMLCSTR lpszValue) const;
926  XMLNode addChild_priv(int, XMLSTR, char, int);
927  XMLAttribute* addAttribute_priv(int, XMLSTR, XMLSTR);
928  XMLCSTR addText_priv(int, XMLSTR, int);
929  XMLClear* addClear_priv(int, XMLSTR, XMLCSTR, XMLCSTR, int);
930  void emptyTheNode(char force);
931  static inline XMLElementPosition findPosition(
932  XMLNodeData* d, int index, XMLElementType xtype);
933  static int CreateXMLStringR(
934  XMLNodeData* pEntry, XMLSTR lpszMarker, int nFormat);
935  static int removeOrderElement(XMLNodeData* d, XMLElementType t, int index);
936  static void exactMemory(XMLNodeData* d);
937  static int detachFromParent(XMLNodeData* d);
938 } XMLNode;
939 
940 /// This structure is given by the function XMLNode::enumContents.
941 typedef struct XMLNodeContents
942 {
943  /// This dictates what's the content of the XMLNodeContent
945  /**< should be an union to access the appropriate data. Compiler does not
946  * allow union of object with constructor... too bad. */
951 
953 
954 /** @defgroup StringAlloc String Allocation/Free functions
955  * @ingroup xmlModify
956  * @{ */
957 /// Duplicate (copy in a new allocated buffer) the source string.
958 XMLDLLENTRY XMLSTR stringDup(XMLCSTR source, int cbData = -1);
959 /**< This is
960  * a very handy function when used with all the "XMLNode::*_WOSD" functions
961  * (\link xmlWOSD \endlink).
962  * @param cbData If !=0 then cbData is the number of chars to duplicate. New
963  * strings allocated with
964  * this function should be free'd using the "freeXMLString" function. */
965 
966 /// to free the string allocated inside the "stringDup" function or the
967 /// "createXMLString" function.
968 XMLDLLENTRY void freeXMLString(XMLSTR t); // {free(t);}
969 /** @} */
970 
971 /** @defgroup atoX ato? like functions
972  * @ingroup XMLParserGeneral
973  * The "xmlto?" functions are equivalents to the atoi, atol, atof functions.
974  * The only difference is: If the variable "xmlString" is nullptr, than the
975  * return value
976  * is "defautValue". These 6 functions are only here as "convenience" functions
977  * for the
978  * user (they are not used inside the XMLparser). If you don't need them, you
979  * can
980  * delete them without any trouble.
981  *
982  * @{ */
983 XMLDLLENTRY char xmltob(XMLCSTR xmlString, char defautValue = 0);
984 XMLDLLENTRY int xmltoi(XMLCSTR xmlString, int defautValue = 0);
985 XMLDLLENTRY long xmltol(XMLCSTR xmlString, long defautValue = 0);
986 XMLDLLENTRY double xmltof(XMLCSTR xmlString, double defautValue = .0);
987 XMLDLLENTRY XMLCSTR xmltoa(XMLCSTR xmlString, XMLCSTR defautValue = _CXML(""));
989  xmltoc(XMLCSTR xmlString, XMLCHAR defautValue = _CXML('\0'));
990 /** @} */
991 
992 /** @defgroup ToXMLStringTool Helper class to create XML files using "printf",
993  * "fprintf", "cout",... functions.
994  * @ingroup XMLParserGeneral
995  * @{ */
996 /// Helper class to create XML files using "printf", "fprintf", "cout",...
997 /// functions.
998 /** The ToXMLStringTool class helps you creating XML files using "printf",
999  * "fprintf", "cout",... functions.
1000  * The "ToXMLStringTool" class is processing strings so that all the characters
1001  * &,",',<,> are replaced by their XML equivalent:
1002  * \verbatim &amp;, &quot;, &apos;, &lt;, &gt; \endverbatim
1003  * Using the "ToXMLStringTool class" and the "fprintf function" is THE most
1004  * efficient
1005  * way to produce VERY large XML documents VERY fast.
1006  * \note If you are creating from scratch an XML file using the provided XMLNode
1007  * class
1008  * you must not use the "ToXMLStringTool" class (because the "XMLNode" class
1009  * does the
1010  * processing job for you during rendering).*/
1012 {
1013  public:
1014  ToXMLStringTool() : buf(nullptr), buflen(0) {}
1015  ~ToXMLStringTool();
1016  void freeBuffer(); ///<call this function when you have finished using this
1017  /// object to release memory used by the internal buffer.
1018 
1019  XMLSTR toXML(XMLCSTR source); ///< returns a pointer to an internal buffer
1020  /// that contains a XML-encoded string based
1021  /// on the "source" parameter.
1022 
1023  /** The "toXMLUnSafe" function is deprecated because there is a possibility
1024  * of
1025  * "destination-buffer-overflow". It converts the string
1026  * "source" to the string "dest". */
1027  static XMLSTR toXMLUnSafe(
1028  XMLSTR dest, XMLCSTR source); ///< deprecated: use "toXML" instead
1029  static int lengthXMLString(
1030  XMLCSTR source); ///< deprecated: use "toXML" instead
1031 
1032  private:
1034  int buflen;
1035 } ToXMLStringTool;
1036 /** @} */
1037 
1038 /** @defgroup XMLParserBase64Tool Helper class to include binary data inside XML
1039  * strings using "Base64 encoding".
1040  * @ingroup XMLParserGeneral
1041  * @{ */
1042 /// Helper class to include binary data inside XML strings using "Base64
1043 /// encoding".
1044 /** The "XMLParserBase64Tool" class allows you to include any binary data
1045  * (images, sounds,...)
1046  * into an XML document using "Base64 encoding". This class is completely
1047  * separated from the rest of the xmlParser library and can be removed without
1048  * any problem.
1049  * To include some binary data into an XML file, you must convert the binary
1050  * data into
1051  * standard text (using "encode"). To retrieve the original binary data from the
1052  * b64-encoded text included inside the XML file, use "decode". Alternatively,
1053  * these
1054  * functions can also be used to "encrypt/decrypt" some critical data contained
1055  * inside
1056  * the XML (it's not a strong encryption at all, but sometimes it can be
1057  * useful). */
1059 {
1060  public:
1061  XMLParserBase64Tool() : buf(nullptr), buflen(0) {}
1063  void freeBuffer(); ///< Call this function when you have finished using
1064  /// this object to release memory used by the internal
1065  /// buffer.
1066 
1067  /**
1068  * @param formatted If "formatted"=true, some space will be reserved for a
1069  * carriage-return every 72 chars. */
1070  static int encodeLength(int inBufLen, char formatted = 0); ///< return the
1071  /// length of the
1072  /// base64 string
1073  /// that encodes
1074  /// a data buffer
1075  /// of size
1076  /// inBufLen
1077  /// bytes.
1078 
1079  /**
1080  * The "base64Encode" function returns a string containing the base64
1081  * encoding of "inByteLen" bytes
1082  * from "inByteBuf". If "formatted" parameter is true, then there will be a
1083  * carriage-return every 72 chars.
1084  * The string will be free'd when the XMLParserBase64Tool object is deleted.
1085  * All returned strings are sharing the same memory space. */
1086  XMLSTR encode(
1087  unsigned char* inByteBuf, unsigned int inByteLen,
1088  char formatted = 0); ///< returns a pointer to an internal buffer
1089  /// containing the base64 string containing the
1090  /// binary data encoded from "inByteBuf"
1091 
1092  /// returns the number of bytes which will be decoded from "inString".
1093  static unsigned int decodeSize(XMLCSTR inString, XMLError* xe = nullptr);
1094 
1095  /**
1096  * The "decode" function returns a pointer to a buffer containing the binary
1097  * data decoded from "inString"
1098  * The output buffer will be free'd when the XMLParserBase64Tool object is
1099  * deleted.
1100  * All output buffer are sharing the same memory space.
1101  * @param inString If "instring" is malformed, nullptr will be returned */
1102  unsigned char* decode(
1103  XMLCSTR inString, int* outByteLen = nullptr,
1104  XMLError* xe = nullptr); ///< returns a pointer to an internal buffer
1105  /// containing the binary data decoded from
1106  ///"inString"
1107 
1108  /**
1109  * decodes data from "inString" to "outByteBuf". You need to provide the
1110  * size (in byte) of "outByteBuf"
1111  * in "inMaxByteOutBuflen". If "outByteBuf" is not large enough or if data
1112  * is malformed, then "FALSE"
1113  * will be returned; otherwise "TRUE". */
1114  static unsigned char decode(
1115  XMLCSTR inString, unsigned char* outByteBuf, int inMaxByteOutBuflen,
1116  XMLError* xe = nullptr); ///< deprecated.
1117 
1118  private:
1119  void* buf;
1120  int buflen;
1121  void alloc(int newsize);
1123 /** @} */
1124 
1125 #undef XMLDLLENTRY
1126 
1127 #endif
Helper class to create XML files using "printf", "fprintf", "cout",...
Definition: xmlParser.h:1011
XMLElementType
Enumeration used to manage type of data.
Definition: xmlParser.h:266
#define _CXML(c)
Definition: xmlParser.h:226
XMLDLLENTRY XMLCHAR xmltoc(XMLCSTR xmlString, XMLCHAR defautValue=_CXML('\0'))
Definition: xmlParser.cpp:515
GLdouble GLdouble t
Definition: glext.h:3689
#define XMLCHAR
Definition: xmlParser.h:229
enum XMLElementType etype
This dictates what&#39;s the content of the XMLNodeContent.
Definition: xmlParser.h:944
XMLCSTR lpszOpenTag
Definition: xmlParser.h:285
Main Class representing a XML node.
Definition: xmlParser.h:314
int nColumn
Definition: xmlParser.h:278
GLuint buffer
Definition: glext.h:3917
XMLCharEncoding
childNode with the specified name if (name==nullptr) return the position of the ith childNode ...
Definition: xmlParser.h:778
struct XMLNodeContents XMLNodeContents
This structure is given by the function XMLNode::enumContents.
Structure for XML clear (unformatted) node (usually comments)
Definition: xmlParser.h:282
This structure is given by the function XMLNode::enumContents.
Definition: xmlParser.h:941
XMLDLLENTRY XMLSTR stringDup(XMLCSTR source, int cbData=-1)
Duplicate (copy in a new allocated buffer) the source string.
Definition: xmlParser.cpp:860
int XMLElementPosition
XMLElementPosition are not interchangeable with simple indexes.
Definition: xmlParser.h:297
#define XMLCSTR
Definition: xmlParser.h:227
struct XMLClear XMLClear
Structure for XML clear (unformatted) node (usually comments)
static XMLClear emptyXMLClear
Definition: xmlParser.h:523
struct XMLDLLENTRY XMLParserBase64Tool XMLParserBase64Tool
Helper class to include binary data inside XML strings using "Base64 encoding".
struct XMLDLLENTRY ToXMLStringTool ToXMLStringTool
Helper class to create XML files using "printf", "fprintf", "cout",...
XMLNodeData * d
Definition: xmlParser.h:917
#define XMLDLLENTRY
Definition: xmlParser.h:186
struct XMLResults XMLResults
Structure used to obtain error details if the parse fails.
struct XMLAttribute XMLAttribute
Structure for XML attribute.
XMLNode()
Definition: xmlParser.h:521
GLuint index
Definition: glext.h:4054
XMLError
Enumeration for XML parse errors.
Definition: xmlParser.h:239
XMLDLLENTRY XMLCSTR xmltoa(XMLCSTR xmlString, XMLCSTR defautValue=_CXML(""))
Definition: xmlParser.cpp:510
#define XMLSTR
Definition: xmlParser.h:228
static XMLNode::XMLCharEncoding characterEncoding
Definition: xmlParser.cpp:33
XMLCSTR lpszValue
Definition: xmlParser.h:284
XMLAttribute * pAttribute
Definition: xmlParser.h:913
static char dropWhiteSpace
Definition: xmlParser.cpp:34
struct XMLNode::XMLNodeDataTag XMLNodeData
struct XMLNodeDataTag * pParent
Definition: xmlParser.h:908
static XMLAttribute emptyXMLAttribute
Definition: xmlParser.h:524
XMLCSTR lpszName
Definition: xmlParser.h:292
XMLNode child
Definition: xmlParser.h:947
Helper class to include binary data inside XML strings using "Base64 encoding".
Definition: xmlParser.h:1058
XMLAttribute attrib
Definition: xmlParser.h:948
#define FALSE
Definition: xmlParser.h:232
XMLDLLENTRY char xmltob(XMLCSTR xmlString, char defautValue=0)
Definition: xmlParser.cpp:489
GLuint const GLchar * name
Definition: glext.h:4054
XMLClear clear
Definition: xmlParser.h:950
GLsizei GLsizei GLchar * source
Definition: glext.h:4082
Structure for XML attribute.
Definition: xmlParser.h:290
static char guessWideCharChars
Definition: xmlParser.cpp:34
XMLCSTR lpszValue
Definition: xmlParser.h:293
enum XMLError error
Definition: xmlParser.h:277
XMLDLLENTRY long xmltol(XMLCSTR xmlString, long defautValue=0)
Definition: xmlParser.cpp:499
GLsizeiptr size
Definition: glext.h:3923
GLenum GLint x
Definition: glext.h:3538
static char removeCommentsInMiddleOfText
Definition: xmlParser.cpp:35
GLubyte GLubyte GLubyte a
Definition: glext.h:6279
GLfloat GLfloat p
Definition: glext.h:6305
XMLCSTR text
Definition: xmlParser.h:949
XMLDLLENTRY void freeXMLString(XMLSTR t)
to free the string allocated inside the "stringDup" function or the "createXMLString" function...
Definition: xmlParser.cpp:28
struct XMLDLLENTRY XMLNode XMLNode
Main Class representing a XML node.
XMLCSTR lpszCloseTag
Definition: xmlParser.h:286
Structure used to obtain error details if the parse fails.
Definition: xmlParser.h:275
XMLDLLENTRY double xmltof(XMLCSTR xmlString, double defautValue=.0)
Definition: xmlParser.cpp:504
XMLDLLENTRY int xmltoi(XMLCSTR xmlString, int defautValue=0)
Definition: xmlParser.cpp:494



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019