MRPT  1.9.9
xmlParser.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://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 #pragma once
153 
154 #include <cstdlib>
155 
156 #ifdef _UNICODE
157 // If you comment the next "define" line then the library will never "switch to"
158 // _UNICODE (wchar_t*) mode (16/32 bits per characters).
159 // This is useful when you get error messages like:
160 // 'XMLNode::openFileHelper' : cannot convert parameter 2 from 'const char
161 // [5]' to 'const wchar_t *'
162 // The _XMLWIDECHAR preprocessor variable force the XMLParser library into
163 // either utf16/32-mode (the proprocessor variable
164 // must be defined) or utf8-mode(the pre-processor variable must be undefined).
165 #define _XMLWIDECHAR
166 #endif
167 
168 #if defined(WIN32) || defined(UNDER_CE) || defined(_WIN32) || defined(WIN64)
169 // comment the next line if you are under windows and the compiler is not
170 // Microsoft Visual Studio (6.0 or .NET) or Borland
171 #define _XMLWINDOWS
172 #endif
173 
174 #ifdef XMLDLLENTRY
175 #undef XMLDLLENTRY
176 #endif
177 #ifdef _USE_XMLPARSER_DLL
178 #ifdef _DLL_EXPORTS_
179 #define XMLDLLENTRY __declspec(dllexport)
180 #else
181 #define XMLDLLENTRY __declspec(dllimport)
182 #endif
183 #else
184 #define XMLDLLENTRY
185 #endif
186 
187 // uncomment the next line if you want no support for wchar_t* (no need for the
188 // <wchar.h> or <tchar.h> libraries anymore to compile)
189 //#define XML_NO_WIDE_CHAR
190 
191 // Mod. JLBC
192 #ifdef __BORLANDC__
193 #define XML_NO_WIDE_CHAR
194 #define strcasecmp(a, b) stricmp(a, b)
195 #define strncasecmp(a, b, c) _strnicmp(a, b, c)
196 #define _timeb timeb
197 #define _ftime(a) ftime(a)
198 #define _strnicmp(a, b, c) strnicmp(a, b, c)
199 #define _errno errno #endif
200 #endif
201 
202 #ifdef XML_NO_WIDE_CHAR
203 #undef _XMLWINDOWS
204 #undef _XMLWIDECHAR
205 #endif
206 
207 #ifdef _XMLWINDOWS
208 #include <tchar.h>
209 #else
210 #define XMLDLLENTRY
211 #ifndef XML_NO_WIDE_CHAR
212 #include <cwchar> // to have 'wcsrtombs' for ANSI version
213 // to have 'mbsrtowcs' for WIDECHAR version
214 #endif
215 #endif
216 
217 // Some common types for char set portable code
218 #ifdef _XMLWIDECHAR
219 #define _CXML(c) L##c
220 #define XMLCSTR const wchar_t*
221 #define XMLSTR wchar_t*
222 #define XMLCHAR wchar_t
223 #else
224 #define _CXML(c) c
225 #define XMLCSTR const char*
226 #define XMLSTR char*
227 #define XMLCHAR char
228 #endif
229 #ifndef FALSE
230 #define FALSE 0
231 #endif /* FALSE */
232 #ifndef TRUE
233 #define TRUE 1
234 #endif /* TRUE */
235 
236 /// Enumeration for XML parse errors.
237 typedef enum XMLError
238 {
256 
261 } XMLError;
262 
263 /// Enumeration used to manage type of data. Use in conjunction with structure
264 /// XMLNodeContents
265 typedef enum XMLElementType
266 {
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 using XMLElementPosition = int;
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() = default;
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  {
780  char_encoding_error = 0,
781  char_encoding_UTF8 = 1,
782  char_encoding_legacy = 2,
783  char_encoding_ShiftJIS = 3,
784  char_encoding_GB2312 = 4,
785  char_encoding_Big5 = 5,
786  char_encoding_GBK = 6 // this is actually the same as Big5
787  } XMLCharEncoding;
788 
789  /** \addtogroup conversions
790  * @{ */
791 
792  /// Sets the global options for the conversions
793  static char setGlobalOptions(
795  char guessWideCharChars = 1, char dropWhiteSpace = 1,
797  /**< The "setGlobalOptions" function allows you to change four global
798  * parameters that affect string & file
799  * parsing. First of all, you most-probably will never have to change these
800  * 3 global parameters.
801  *
802  * @param guessWideCharChars If "guessWideCharChars"=1 and if this library
803  * is compiled in WideChar mode, then the
804  * XMLNode::parseFile and XMLNode::openFileHelper functions will test if
805  * the file contains ASCII
806  * characters. If this is the case, then the file will be loaded and
807  * converted in memory to
808  * WideChar before being parsed. If 0, no conversion will be performed.
809  *
810  * @param guessWideCharChars If "guessWideCharChars"=1 and if this library
811  * is compiled in ASCII/UTF8/char* mode, then the
812  * XMLNode::parseFile and XMLNode::openFileHelper functions will test if
813  * the file contains WideChar
814  * characters. If this is the case, then the file will be loaded and
815  * converted in memory to
816  * ASCII/UTF8/char* before being parsed. If 0, no conversion will be
817  * performed.
818  *
819  * @param characterEncoding This parameter is only meaningful when compiling
820  * in char* mode (multibyte character mode).
821  * In wchar_t* (wide char mode), this parameter is ignored. This
822  * parameter should be one of the
823  * three currently recognized encodings: XMLNode::encoding_UTF8,
824  * XMLNode::encoding_ascii,
825  * XMLNode::encoding_ShiftJIS.
826  *
827  * @param dropWhiteSpace In most situations, text fields containing only
828  * white spaces (and carriage returns)
829  * are useless. Even more, these "empty" text fields are annoying
830  * because they increase the
831  * complexity of the user's code for parsing. So, 99% of the time, it's
832  * better to drop
833  * the "empty" text fields. However The XML specification indicates that
834  * no white spaces
835  * should be lost when parsing the file. So to be perfectly
836  * XML-compliant, you should set
837  * dropWhiteSpace=0. A note of caution: if you set "dropWhiteSpace=0",
838  * the parser will be
839  * slower and your code will be more complex.
840  *
841  * @param removeCommentsInMiddleOfText To explain this parameter, let's
842  * consider this code:
843  * \code
844  * XMLNode x=XMLNode::parseString("<a>foo<!-- hello -->bar<!DOCTYPE
845  * world >chu</a>","a");
846  * \endcode
847  * If removeCommentsInMiddleOfText=0, then we will have:
848  * \code
849  * x.getText(0) -> "foo"
850  * x.getText(1) -> "bar"
851  * x.getText(2) -> "chu"
852  * x.getClear(0) --> "<!-- hello -->"
853  * x.getClear(1) --> "<!DOCTYPE world >"
854  * \endcode
855  * If removeCommentsInMiddleOfText=1, then we will have:
856  * \code
857  * x.getText(0) -> "foobar"
858  * x.getText(1) -> "chu"
859  * x.getClear(0) --> "<!DOCTYPE world >"
860  * \endcode
861  *
862  * \return "0" when there are no errors. If you try to set an unrecognized
863  * encoding then the return value will be "1" to signal an error.
864  *
865  * \note Sometime, it's useful to set "guessWideCharChars=0" to disable any
866  * conversion
867  * because the test to detect the file-type (ASCII/UTF8/char* or WideChar)
868  * may fail (rarely). */
869 
870  /// Guess the character encoding of the string (ascii, utf8 or shift-JIS)
871  static XMLCharEncoding guessCharEncoding(
872  void* buffer, int bufLen, char useXMLEncodingAttribute = 1);
873  /**< The "guessCharEncoding" function try to guess the character encoding.
874  * You most-probably will never
875  * have to use this function. It then returns the appropriate value of the
876  * global parameter
877  * "characterEncoding" described in the XMLNode::setGlobalOptions. The guess
878  * is based on the content of a buffer of length
879  * "bufLen" bytes that contains the first bytes (minimum 25 bytes; 200 bytes
880  * is a good value) of the
881  * file to be parsed. The XMLNode::openFileHelper function is using this
882  * function to automatically compute
883  * the value of the "characterEncoding" global parameter. There are several
884  * heuristics used to do the
885  * guess. One of the heuristic is based on the "encoding" attribute. The
886  * original XML specifications
887  * forbids to use this attribute to do the guess but you can still use it if
888  * you set
889  * "useXMLEncodingAttribute" to 1 (this is the default behavior and the
890  * behavior of most parsers).
891  * If an inconsistency in the encoding is detected, then the return value is
892  * "0". */
893  /** @} */
894 
895  private:
896  // these are functions and structures used internally by the XMLNode class
897  // (don't bother about them):
898 
899  typedef struct XMLNodeDataTag // to allow shallow copy and
900  // "intelligent/smart" pointers (automatic
901  // delete):
902  {
903  XMLCSTR lpszName; // Element name (=nullptr if root)
904  int nChild, // Number of child nodes
905  nText, // Number of text fields
906  nClear, // Number of Clear fields (comments)
907  nAttribute; // Number of attributes
908  char isDeclaration; // Whether node is an XML declaration - '<?xml ?>'
910  pParent; // Pointer to parent element (=nullptr if root)
911  XMLNode* pChild; // Array of child nodes
912  XMLCSTR* pText; // Array of text fields
913  XMLClear* pClear; // Array of clear fields
914  XMLAttribute* pAttribute; // Array of attributes
915  int* pOrder; // order of the child_nodes,text_fields,clear_fields
916  int ref_count; // for garbage collection (smart pointers)
917  } XMLNodeData;
918  XMLNodeData* d{nullptr};
919 
920  char parseClearTag(void* px, void* pa);
921  char maybeAddTxT(void* pa, XMLCSTR tokenPStr);
922  int ParseXMLElement(void* pXML);
923  void* addToOrder(
924  int memInc, int* _pos, int nc, void* p, int size, XMLElementType xtype);
925  int indexText(XMLCSTR lpszValue) const;
926  int indexClear(XMLCSTR lpszValue) const;
927  XMLNode addChild_priv(int, XMLSTR, char, int);
928  XMLAttribute* addAttribute_priv(int, XMLSTR, XMLSTR);
929  XMLCSTR addText_priv(int, XMLSTR, int);
930  XMLClear* addClear_priv(int, XMLSTR, XMLCSTR, XMLCSTR, int);
931  void emptyTheNode(char force);
932  static inline XMLElementPosition findPosition(
933  XMLNodeData* d, int index, XMLElementType xtype);
934  static int CreateXMLStringR(
935  XMLNodeData* pEntry, XMLSTR lpszMarker, int nFormat);
936  static int removeOrderElement(XMLNodeData* d, XMLElementType t, int index);
937  static void exactMemory(XMLNodeData* d);
938  static int detachFromParent(XMLNodeData* d);
939 } XMLNode;
940 
941 /// This structure is given by the function XMLNode::enumContents.
942 typedef struct XMLNodeContents
943 {
944  /// This dictates what's the content of the XMLNodeContent
946  /**< should be an union to access the appropriate data. Compiler does not
947  * allow union of object with constructor... too bad. */
952 
954 
955 /** @defgroup StringAlloc String Allocation/Free functions
956  * @ingroup xmlModify
957  * @{ */
958 /// Duplicate (copy in a new allocated buffer) the source string.
959 XMLDLLENTRY XMLSTR stringDup(XMLCSTR source, int cbData = -1);
960 /**< This is
961  * a very handy function when used with all the "XMLNode::*_WOSD" functions
962  * (\link xmlWOSD \endlink).
963  * @param cbData If !=0 then cbData is the number of chars to duplicate. New
964  * strings allocated with
965  * this function should be free'd using the "freeXMLString" function. */
966 
967 /// to free the string allocated inside the "stringDup" function or the
968 /// "createXMLString" function.
969 XMLDLLENTRY void freeXMLString(XMLSTR t); // {free(t);}
970 /** @} */
971 
972 /** @defgroup atoX ato? like functions
973  * @ingroup XMLParserGeneral
974  * The "xmlto?" functions are equivalents to the atoi, atol, atof functions.
975  * The only difference is: If the variable "xmlString" is nullptr, than the
976  * return value
977  * is "defautValue". These 6 functions are only here as "convenience" functions
978  * for the
979  * user (they are not used inside the XMLparser). If you don't need them, you
980  * can
981  * delete them without any trouble.
982  *
983  * @{ */
984 XMLDLLENTRY char xmltob(XMLCSTR xmlString, char defautValue = 0);
985 XMLDLLENTRY int xmltoi(XMLCSTR xmlString, int defautValue = 0);
986 XMLDLLENTRY long xmltol(XMLCSTR xmlString, long defautValue = 0);
987 XMLDLLENTRY double xmltof(XMLCSTR xmlString, double defautValue = .0);
988 XMLDLLENTRY XMLCSTR xmltoa(XMLCSTR xmlString, XMLCSTR defautValue = _CXML(""));
990  xmltoc(XMLCSTR xmlString, XMLCHAR defautValue = _CXML('\0'));
991 /** @} */
992 
993 /** @defgroup ToXMLStringTool Helper class to create XML files using "printf",
994  * "fprintf", "cout",... functions.
995  * @ingroup XMLParserGeneral
996  * @{ */
997 /// Helper class to create XML files using "printf", "fprintf", "cout",...
998 /// functions.
999 /** The ToXMLStringTool class helps you creating XML files using "printf",
1000  * "fprintf", "cout",... functions.
1001  * The "ToXMLStringTool" class is processing strings so that all the characters
1002  * &,",',<,> are replaced by their XML equivalent:
1003  * \verbatim &amp;, &quot;, &apos;, &lt;, &gt; \endverbatim
1004  * Using the "ToXMLStringTool class" and the "fprintf function" is THE most
1005  * efficient
1006  * way to produce VERY large XML documents VERY fast.
1007  * \note If you are creating from scratch an XML file using the provided XMLNode
1008  * class
1009  * you must not use the "ToXMLStringTool" class (because the "XMLNode" class
1010  * does the
1011  * processing job for you during rendering).*/
1013 {
1014  public:
1015  ToXMLStringTool() : buf(nullptr) {}
1016  ~ToXMLStringTool();
1017  void freeBuffer(); ///< call this function when you have finished using
1018  ///< this
1019  /// object to release memory used by the internal buffer.
1020 
1021  XMLSTR toXML(XMLCSTR source); ///< returns a pointer to an internal buffer
1022  /// that contains a XML-encoded string based
1023  /// on the "source" parameter.
1024 
1025  /** The "toXMLUnSafe" function is deprecated because there is a possibility
1026  * of
1027  * "destination-buffer-overflow". It converts the string
1028  * "source" to the string "dest". */
1029  static XMLSTR toXMLUnSafe(
1030  XMLSTR dest, XMLCSTR source); ///< deprecated: use "toXML" instead
1031  static int lengthXMLString(
1032  XMLCSTR source); ///< deprecated: use "toXML" instead
1033 
1034  private:
1036  int buflen{0};
1037 } ToXMLStringTool;
1038 /** @} */
1039 
1040 /** @defgroup XMLParserBase64Tool Helper class to include binary data inside XML
1041  * strings using "Base64 encoding".
1042  * @ingroup XMLParserGeneral
1043  * @{ */
1044 /// Helper class to include binary data inside XML strings using "Base64
1045 /// encoding".
1046 /** The "XMLParserBase64Tool" class allows you to include any binary data
1047  * (images, sounds,...)
1048  * into an XML document using "Base64 encoding". This class is completely
1049  * separated from the rest of the xmlParser library and can be removed without
1050  * any problem.
1051  * To include some binary data into an XML file, you must convert the binary
1052  * data into
1053  * standard text (using "encode"). To retrieve the original binary data from the
1054  * b64-encoded text included inside the XML file, use "decode". Alternatively,
1055  * these
1056  * functions can also be used to "encrypt/decrypt" some critical data contained
1057  * inside
1058  * the XML (it's not a strong encryption at all, but sometimes it can be
1059  * useful). */
1061 {
1062  public:
1063  XMLParserBase64Tool() = default;
1065  void freeBuffer(); ///< Call this function when you have finished using
1066  /// this object to release memory used by the internal
1067  /// buffer.
1068 
1069  /**
1070  * @param formatted If "formatted"=true, some space will be reserved for a
1071  * carriage-return every 72 chars. */
1072  static int encodeLength(int inBufLen, char formatted = 0); ///< return the
1073  /// length of the
1074  /// base64 string
1075  /// that encodes
1076  /// a data buffer
1077  /// of size
1078  /// inBufLen
1079  /// bytes.
1080 
1081  /**
1082  * The "base64Encode" function returns a string containing the base64
1083  * encoding of "inByteLen" bytes
1084  * from "inByteBuf". If "formatted" parameter is true, then there will be a
1085  * carriage-return every 72 chars.
1086  * The string will be free'd when the XMLParserBase64Tool object is deleted.
1087  * All returned strings are sharing the same memory space. */
1088  XMLSTR encode(
1089  unsigned char* inByteBuf, unsigned int inByteLen,
1090  char formatted = 0); ///< returns a pointer to an internal buffer
1091  /// containing the base64 string containing the
1092  /// binary data encoded from "inByteBuf"
1093 
1094  /// returns the number of bytes which will be decoded from "inString".
1095  static unsigned int decodeSize(XMLCSTR inString, XMLError* xe = nullptr);
1096 
1097  /**
1098  * The "decode" function returns a pointer to a buffer containing the binary
1099  * data decoded from "inString"
1100  * The output buffer will be free'd when the XMLParserBase64Tool object is
1101  * deleted.
1102  * All output buffer are sharing the same memory space.
1103  * @param inString If "instring" is malformed, nullptr will be returned */
1104  unsigned char* decode(
1105  XMLCSTR inString, int* outByteLen = nullptr,
1106  XMLError* xe = nullptr); ///< returns a pointer to an internal buffer
1107  /// containing the binary data decoded from
1108  ///"inString"
1109 
1110  /**
1111  * decodes data from "inString" to "outByteBuf". You need to provide the
1112  * size (in byte) of "outByteBuf"
1113  * in "inMaxByteOutBuflen". If "outByteBuf" is not large enough or if data
1114  * is malformed, then "FALSE"
1115  * will be returned; otherwise "TRUE". */
1116  static unsigned char decode(
1117  XMLCSTR inString, unsigned char* outByteBuf, int inMaxByteOutBuflen,
1118  XMLError* xe = nullptr); ///< deprecated.
1119 
1120  private:
1121  void* buf{nullptr};
1122  int buflen{0};
1123  void alloc(int newsize);
1125 /** @} */
1126 
1127 #undef XMLDLLENTRY
Helper class to create XML files using "printf", "fprintf", "cout",...
Definition: xmlParser.h:1012
XMLElementType
Enumeration used to manage type of data.
Definition: xmlParser.h:265
#define _CXML(c)
Definition: xmlParser.h:224
XMLDLLENTRY XMLCHAR xmltoc(XMLCSTR xmlString, XMLCHAR defautValue=_CXML('\0'))
Definition: xmlParser.cpp:515
GLdouble GLdouble t
Definition: glext.h:3695
#define XMLCHAR
Definition: xmlParser.h:227
enum XMLElementType etype
This dictates what&#39;s the content of the XMLNodeContent.
Definition: xmlParser.h:945
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:3928
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:942
XMLDLLENTRY XMLSTR stringDup(XMLCSTR source, int cbData=-1)
Duplicate (copy in a new allocated buffer) the source string.
Definition: xmlParser.cpp:861
#define XMLCSTR
Definition: xmlParser.h:225
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",...
#define XMLDLLENTRY
Definition: xmlParser.h:184
struct XMLResults XMLResults
Structure used to obtain error details if the parse fails.
struct XMLAttribute XMLAttribute
Structure for XML attribute.
GLuint index
Definition: glext.h:4068
XMLError
Enumeration for XML parse errors.
Definition: xmlParser.h:237
XMLDLLENTRY XMLCSTR xmltoa(XMLCSTR xmlString, XMLCSTR defautValue=_CXML(""))
Definition: xmlParser.cpp:510
#define XMLSTR
Definition: xmlParser.h:226
static XMLNode::XMLCharEncoding characterEncoding
Definition: xmlParser.cpp:33
XMLCSTR lpszValue
Definition: xmlParser.h:284
XMLAttribute * pAttribute
Definition: xmlParser.h:914
static char dropWhiteSpace
Definition: xmlParser.cpp:34
struct XMLNode::XMLNodeDataTag XMLNodeData
struct XMLNodeDataTag * pParent
Definition: xmlParser.h:909
static XMLAttribute emptyXMLAttribute
Definition: xmlParser.h:524
XMLCSTR lpszName
Definition: xmlParser.h:292
int XMLElementPosition
XMLElementPosition are not interchangeable with simple indexes.
Definition: xmlParser.h:297
XMLNode child
Definition: xmlParser.h:948
Helper class to include binary data inside XML strings using "Base64 encoding".
Definition: xmlParser.h:1060
XMLAttribute attrib
Definition: xmlParser.h:949
#define FALSE
Definition: xmlParser.h:230
XMLDLLENTRY char xmltob(XMLCSTR xmlString, char defautValue=0)
Definition: xmlParser.cpp:489
GLuint const GLchar * name
Definition: glext.h:4068
XMLClear clear
Definition: xmlParser.h:951
GLsizei GLsizei GLchar * source
Definition: glext.h:4097
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:3934
GLenum GLint x
Definition: glext.h:3542
static char removeCommentsInMiddleOfText
Definition: xmlParser.cpp:35
static XMLNode emptyXMLNode
Definition: xmlParser.h:522
GLubyte GLubyte GLubyte a
Definition: glext.h:6372
GLfloat GLfloat p
Definition: glext.h:6398
XMLCSTR text
Definition: xmlParser.h:950
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: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019