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-2018, 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) || defined(WIN64)
170 // comment the next line if you are under windows and the compiler is not
171 // Microsoft Visual Studio (6.0 or .NET) or Borland
172 #define _XMLWINDOWS
173 #endif
174 
175 #ifdef XMLDLLENTRY
176 #undef XMLDLLENTRY
177 #endif
178 #ifdef _USE_XMLPARSER_DLL
179 #ifdef _DLL_EXPORTS_
180 #define XMLDLLENTRY __declspec(dllexport)
181 #else
182 #define XMLDLLENTRY __declspec(dllimport)
183 #endif
184 #else
185 #define XMLDLLENTRY
186 #endif
187 
188 // uncomment the next line if you want no support for wchar_t* (no need for the
189 // <wchar.h> or <tchar.h> libraries anymore to compile)
190 //#define XML_NO_WIDE_CHAR
191 
192 // Mod. JLBC
193 #ifdef __BORLANDC__
194 #define XML_NO_WIDE_CHAR
195 #define strcasecmp(a, b) stricmp(a, b)
196 #define strncasecmp(a, b, c) _strnicmp(a, b, c)
197 #define _timeb timeb
198 #define _ftime(a) ftime(a)
199 #define _strnicmp(a, b, c) strnicmp(a, b, c)
200 #define _errno errno #endif
201 #endif
202 
203 #ifdef XML_NO_WIDE_CHAR
204 #undef _XMLWINDOWS
205 #undef _XMLWIDECHAR
206 #endif
207 
208 #ifdef _XMLWINDOWS
209 #include <tchar.h>
210 #else
211 #define XMLDLLENTRY
212 #ifndef XML_NO_WIDE_CHAR
213 #include <wchar.h> // to have 'wcsrtombs' for ANSI version
214 // to have 'mbsrtowcs' for WIDECHAR version
215 #endif
216 #endif
217 
218 // Some common types for char set portable code
219 #ifdef _XMLWIDECHAR
220 #define _CXML(c) L##c
221 #define XMLCSTR const wchar_t*
222 #define XMLSTR wchar_t*
223 #define XMLCHAR wchar_t
224 #else
225 #define _CXML(c) c
226 #define XMLCSTR const char*
227 #define XMLSTR char*
228 #define XMLCHAR char
229 #endif
230 #ifndef FALSE
231 #define FALSE 0
232 #endif /* FALSE */
233 #ifndef TRUE
234 #define TRUE 1
235 #endif /* TRUE */
236 
237 /// Enumeration for XML parse errors.
238 typedef enum XMLError {
256 
261 } XMLError;
262 
263 /// Enumeration used to manage type of data. Use in conjunction with structure
264 /// XMLNodeContents
265 typedef enum XMLElementType {
272 
273 /// Structure used to obtain error details if the parse fails.
274 typedef struct XMLResults
275 {
278 } XMLResults;
279 
280 /// Structure for XML clear (unformatted) node (usually comments)
281 typedef struct XMLClear
282 {
286 } XMLClear;
287 
288 /// Structure for XML attribute.
289 typedef struct XMLAttribute
290 {
293 } XMLAttribute;
294 
295 /// XMLElementPosition are not interchangeable with simple indexes
296 using XMLElementPosition = int;
297 
298 struct XMLNodeContents;
299 
300 /** @defgroup XMLParserGeneral The XML parser */
301 
302 /// Main Class representing a XML node
303 /**
304  * All operations are performed using this class.
305  * \note The constructors of the XMLNode class are protected, so use instead one
306  * of these four methods to get your first instance of XMLNode:
307  * <ul>
308  * <li> XMLNode::parseString </li>
309  * <li> XMLNode::parseFile </li>
310  * <li> XMLNode::openFileHelper </li>
311  * <li> XMLNode::createXMLTopNode (or XMLNode::createXMLTopNode_WOSD)</li>
312  * </ul> */
313 typedef struct XMLDLLENTRY XMLNode
314 {
315  private:
316  struct XMLNodeDataTag;
317 
318  /// Constructors are protected, so use instead one of: XMLNode::parseString,
319  /// XMLNode::parseFile, XMLNode::openFileHelper, XMLNode::createXMLTopNode
320  XMLNode(
321  struct XMLNodeDataTag* pParent, XMLSTR lpszName, char isDeclaration);
322  /// Constructors are protected, so use instead one of: XMLNode::parseString,
323  /// XMLNode::parseFile, XMLNode::openFileHelper, XMLNode::createXMLTopNode
324  XMLNode(struct XMLNodeDataTag* p);
325 
326  public:
327  static XMLCSTR
328  getVersion(); ///< Return the XMLParser library version number
329 
330  /** @defgroup conversions Parsing XML files/strings to an XMLNode structure
331  * and Rendering XMLNode's to files/string.
332  * @ingroup XMLParserGeneral
333  * @{ */
334 
335  /// Parse an XML string and return the root of a XMLNode tree representing
336  /// the string.
337  static XMLNode parseString(
338  XMLCSTR lpXMLString, XMLCSTR tag = nullptr,
339  XMLResults* pResults = nullptr);
340  /**< The "parseString" function parse an XML string and return the root of a
341  * XMLNode tree. The "opposite" of this function is
342  * the function "createXMLString" that re-creates an XML string from an
343  * XMLNode tree. If the XML document is corrupted, the
344  * "parseString" method will initialize the "pResults" variable with some
345  * information that can be used to trace the error.
346  * If you still want to parse the file, you can use the APPROXIMATE_PARSING
347  * option as explained inside the note at the
348  * beginning of the "xmlParser.cpp" file.
349  *
350  * @param lpXMLString the XML string to parse
351  * @param tag the name of the first tag inside the XML file. If the tag
352  * parameter is omitted, this function returns a node that represents the
353  * head of the xml document including the declaration term (<? ... ?>).
354  * @param pResults a pointer to a XMLResults variable that will contain some
355  * information that can be used to trace the XML parsing error. You can have
356  * a user-friendly explanation of the parsing error with the "getError"
357  * function.
358  */
359 
360  /// Parse an XML file and return the root of a XMLNode tree representing the
361  /// file.
362  static XMLNode parseFile(
363  XMLCSTR filename, XMLCSTR tag = nullptr,
364  XMLResults* pResults = nullptr);
365  /**< The "parseFile" function parse an XML file and return the root of a
366  * XMLNode tree. The "opposite" of this function is
367  * the function "writeToFile" that re-creates an XML file from an XMLNode
368  * tree. If the XML document is corrupted, the
369  * "parseFile" method will initialize the "pResults" variable with some
370  * information that can be used to trace the error.
371  * If you still want to parse the file, you can use the APPROXIMATE_PARSING
372  * option as explained inside the note at the
373  * beginning of the "xmlParser.cpp" file.
374  *
375  * @param filename the path to the XML file to parse
376  * @param tag the name of the first tag inside the XML file. If the tag
377  * parameter is omitted, this function returns a node that represents the
378  * head of the xml document including the declaration term (<? ... ?>).
379  * @param pResults a pointer to a XMLResults variable that will contain some
380  * information that can be used to trace the XML parsing error. You can have
381  * a user-friendly explanation of the parsing error with the "getError"
382  * function.
383  */
384 
385  /// Parse an XML file and return the root of a XMLNode tree representing the
386  /// file. A very crude error checking is made. An attempt to guess the Char
387  /// Encoding used in the file is made.
388  static XMLNode openFileHelper(XMLCSTR filename, XMLCSTR tag = nullptr);
389  /**< The "openFileHelper" function reports to the screen all the warnings
390  * and errors that occurred during parsing of the XML file.
391  * This function also tries to guess char Encoding (UTF-8, ASCII or
392  * SHIT-JIS) based on the first 200 bytes of the file. Since each
393  * application has its own way to report and deal with errors, you should
394  * rather use the "parseFile" function to parse XML files
395  * and program yourself thereafter an "error reporting" tailored for your
396  * needs (instead of using the very crude "error reporting"
397  * mechanism included inside the "openFileHelper" function).
398  *
399  * If the XML document is corrupted, the "openFileHelper" method will:
400  * - display an error message on the console (or inside a messageBox
401  * for windows).
402  * - stop execution (exit).
403  *
404  * I strongly suggest that you write your own "openFileHelper" method
405  * tailored to your needs. If you still want to parse
406  * the file, you can use the APPROXIMATE_PARSING option as explained inside
407  * the note at the beginning of the "xmlParser.cpp" file.
408  *
409  * @param filename the path of the XML file to parse.
410  * @param tag the name of the first tag inside the XML file. If the tag
411  * parameter is omitted, this function returns a node that represents the
412  * head of the xml document including the declaration term (<? ... ?>).
413  */
414 
415  static XMLCSTR getError(XMLError error); ///< this gives you a
416  /// user-friendly explanation of
417  /// the parsing error
418 
419  /// Create an XML string starting from the current XMLNode.
420  XMLSTR createXMLString(int nFormat = 1, int* pnSize = nullptr) const;
421  /**< The returned string should be free'd using the "freeXMLString"
422  * function.
423  *
424  * If nFormat==0, no formatting is required otherwise this returns an user
425  * friendly XML string from a given element
426  * with appropriate white spaces and carriage returns. if pnSize is given
427  * it returns the size in character of the string. */
428 
429  /// Save the content of an xmlNode inside a file
430  XMLError writeToFile(
431  XMLCSTR filename, const char* encoding = nullptr,
432  char nFormat = 1) const;
433  /**< If nFormat==0, no formatting is required otherwise this returns an user
434  * friendly XML string from a given element with appropriate white spaces
435  * and carriage returns.
436  * If the global parameter "characterEncoding==encoding_UTF8", then the
437  * "encoding" parameter is ignored and always set to "utf-8".
438  * If the global parameter "characterEncoding==encoding_ShiftJIS", then the
439  * "encoding" parameter is ignored and always set to "SHIFT-JIS".
440  * If "_XMLWIDECHAR=1", then the "encoding" parameter is ignored and always
441  * set to "utf-16".
442  * If no "encoding" parameter is given the "ISO-8859-1" encoding is used. */
443  /** @} */
444 
445  /** @defgroup navigate Navigate the XMLNode structure
446  * @ingroup XMLParserGeneral
447  * @{ */
448  XMLCSTR getName() const; ///< name of the node
449  XMLCSTR getText(int i = 0) const; ///< return ith text field
450  int nText() const; ///< nbr of text field
451  XMLNode getParentNode() const; ///< return the parent node
452  XMLNode getChildNode(int i = 0) const; ///< return ith child node
453  XMLNode getChildNode(XMLCSTR name, int i) const; ///< return ith child node
454  /// with specific name
455  ///(return an empty node
456  /// if failing). If i==-1,
457  /// this returns the last
458  /// XMLNode with the given
459  /// name.
460  XMLNode getChildNode(XMLCSTR name, int* i = nullptr) const; ///< return
461  /// next child
462  /// node with
463  /// specific
464  /// name (return
465  /// an empty
466  /// node if
467  /// failing)
468  XMLNode getChildNodeWithAttribute(
469  XMLCSTR tagName, XMLCSTR attributeName,
470  XMLCSTR attributeValue = nullptr,
471  int* i = nullptr) const; ///< return child node with specific
472  /// name/attribute (return an empty node if
473  /// failing)
474  XMLNode getChildNodeByPath(
475  XMLSTR path, char createNodeIfMissing = 0, XMLCHAR sep = '/');
476  ///< return the first child node with specific path. WARNING: the value of
477  /// the parameter "path" is destroyed!
478  XMLNode getChildNodeByPath(
479  XMLCSTR path, char createNodeIfMissing = 0, XMLCHAR sep = '/');
480  ///< return the first child node with specific path
481 
482  int nChildNode(XMLCSTR name)
483  const; ///< return the number of child node with specific name
484  int nChildNode() const; ///< nbr of child node
485  XMLAttribute getAttribute(int i = 0) const; ///< return ith attribute
486  XMLCSTR getAttributeName(int i = 0) const; ///< return ith attribute name
487  XMLCSTR getAttributeValue(int i = 0) const; ///< return ith attribute value
488  char isAttributeSet(XMLCSTR name)
489  const; ///< test if an attribute with a specific name is given
490  XMLCSTR getAttribute(XMLCSTR name, int i) const; ///< return ith attribute
491  /// content with specific
492  /// name (return a nullptr
493  /// if failing)
494  XMLCSTR getAttribute(XMLCSTR name, int* i = nullptr) const; ///< return
495  /// next
496  /// attribute
497  /// content with
498  /// specific
499  /// name (return
500  /// a nullptr if
501  /// failing)
502  int nAttribute() const; ///< nbr of attribute
503  XMLClear getClear(int i = 0) const; ///< return ith clear field (comments)
504  int nClear() const; ///< nbr of clear field
505  XMLNodeContents enumContents(XMLElementPosition i)
506  const; ///< enumerate all the different contents (attribute,child,text,
507  /// clear) of the current XMLNode. The order is reflecting the
508  /// order of the original file/string. NOTE: 0 <= i < nElement();
509  int nElement() const; ///< nbr of different contents for current node
510  char isEmpty() const; ///< is this node Empty?
511  char isDeclaration() const; ///< is this node a declaration <? .... ?>
512  XMLNode deepCopy() const; ///< deep copy (duplicate/clone) a XMLNode
513  static XMLNode emptyNode(); ///< return XMLNode::emptyXMLNode;
514  /** @} */
515 
516  ~XMLNode();
517  XMLNode(const XMLNode& A); ///< to allow shallow/fast copy:
518  XMLNode& operator=(const XMLNode& A); ///< to allow shallow/fast copy:
519 
520  XMLNode() : d(nullptr){};
521  static XMLNode emptyXMLNode;
524 
525  /** @defgroup xmlModify Create or Update the XMLNode structure
526  * @ingroup XMLParserGeneral
527  * The functions in this group allows you to create from scratch (or
528  * update) a XMLNode structure. Start by creating your top
529  * node with the "createXMLTopNode" function and then add new nodes with
530  * the "addChild" function. The parameter 'pos' gives
531  * the position where the childNode, the text or the XMLClearTag will be
532  * inserted. The default value (pos=-1) inserts at the
533  * end. The value (pos=0) insert at the beginning (Insertion at the
534  * beginning is slower than at the end). <br>
535  *
536  * REMARK: 0 <= pos < nChild()+nText()+nClear() <br>
537  */
538 
539  /** @defgroup creation Creating from scratch a XMLNode structure
540  * @ingroup xmlModify
541  * @{ */
542  static XMLNode createXMLTopNode(
543  XMLCSTR lpszName,
544  char isDeclaration =
545  FALSE); ///< Create the top node of an XMLNode structure
546  XMLNode addChild(
547  XMLCSTR lpszName, char isDeclaration = FALSE,
548  XMLElementPosition pos = -1); ///< Add a new child node
549  XMLNode addChild(
550  XMLNode nodeToAdd,
551  XMLElementPosition pos = -1); ///< If the "nodeToAdd" has some parents,
552  /// it will be detached from it's parents
553  /// before being attached to the current
554  /// XMLNode
555  XMLAttribute* addAttribute(
556  XMLCSTR lpszName, XMLCSTR lpszValuev); ///< Add a new attribute
557  XMLCSTR addText(
558  XMLCSTR lpszValue,
559  XMLElementPosition pos = -1); ///< Add a new text content
560  XMLClear* addClear(
561  XMLCSTR lpszValue, XMLCSTR lpszOpen = nullptr,
562  XMLCSTR lpszClose = nullptr, XMLElementPosition pos = -1);
563  /**< Add a new clear tag
564  * @param lpszOpen default value "<![CDATA["
565  * @param lpszClose default value "]]>"
566  */
567  /** @} */
568 
569  /** @defgroup xmlUpdate Updating Nodes
570  * @ingroup xmlModify
571  * Some update functions:
572  * @{
573  */
574  XMLCSTR updateName(XMLCSTR lpszName); ///< change node's name
575  XMLAttribute* updateAttribute(
576  XMLAttribute* newAttribute,
577  XMLAttribute* oldAttribute); ///< if the attribute to update is
578  /// missing, a new one will be added
579  XMLAttribute* updateAttribute(
580  XMLCSTR lpszNewValue, XMLCSTR lpszNewName = nullptr,
581  int i = 0); ///< if the attribute to update is missing, a new one will
582  /// be added
583  XMLAttribute* updateAttribute(
584  XMLCSTR lpszNewValue, XMLCSTR lpszNewName,
585  XMLCSTR lpszOldName); ///< set lpszNewName=nullptr if you don't want to
586  /// change the name of the attribute if the
587  /// attribute to update is missing, a new one will
588  /// be added
589  XMLCSTR updateText(XMLCSTR lpszNewValue, int i = 0); ///< if the text to
590  /// update is missing,
591  /// a new one will be
592  /// added
593  XMLCSTR updateText(XMLCSTR lpszNewValue, XMLCSTR lpszOldValue); ///< if the
594  /// text to
595  /// update
596  /// is
597  /// missing,
598  /// a new
599  /// one will
600  /// be added
601  XMLClear* updateClear(XMLCSTR lpszNewContent, int i = 0); ///< if the
602  /// clearTag to
603  /// update is
604  /// missing, a new
605  /// one will be
606  /// added
607  XMLClear* updateClear(XMLClear* newP, XMLClear* oldP); ///< if the clearTag
608  /// to update is
609  /// missing, a new
610  /// one will be added
611  XMLClear* updateClear(
612  XMLCSTR lpszNewValue, XMLCSTR lpszOldValue); ///< if the clearTag to
613  /// update is missing, a
614  /// new one will be added
615  /** @} */
616 
617  /** @defgroup xmlDelete Deleting Nodes or Attributes
618  * @ingroup xmlModify
619  * Some deletion functions:
620  * @{
621  */
622  /// The "deleteNodeContent" function forces the deletion of the content of
623  /// this XMLNode and the subtree.
624  void deleteNodeContent();
625  /**< \note The XMLNode instances that are referring to the part of the
626  * subtree that has been deleted CANNOT be used anymore!!. Unexpected
627  * results will occur if you continue using them. */
628  void deleteAttribute(
629  int i = 0); ///< Delete the ith attribute of the current XMLNode
630  void deleteAttribute(XMLCSTR lpszName); ///< Delete the attribute with the
631  /// given name (the "strcmp"
632  /// function is used to find the
633  /// right attribute)
634  void deleteAttribute(XMLAttribute* anAttribute); ///< Delete the attribute
635  /// with the name
636  ///"anAttribute->lpszName"
637  ///(the "strcmp" function
638  /// is used to find the
639  /// right attribute)
640  void deleteText(
641  int i = 0); ///< Delete the Ith text content of the current XMLNode
642  void deleteText(XMLCSTR lpszValue); ///< Delete the text content
643  ///"lpszValue" inside the current
644  /// XMLNode (direct "pointer-to-pointer"
645  /// comparison is used to find the right
646  /// text)
647  void deleteClear(
648  int i = 0); ///< Delete the Ith clear tag inside the current XMLNode
649  void deleteClear(XMLCSTR lpszValue); ///< Delete the clear tag "lpszValue"
650  /// inside the current XMLNode (direct
651  ///"pointer-to-pointer" comparison is
652  /// used to find the clear tag)
653  void deleteClear(XMLClear* p); ///< Delete the clear tag "p" inside the
654  /// current XMLNode (direct
655  ///"pointer-to-pointer" comparison on the
656  /// lpszName of the clear tag is used to find
657  /// the clear tag)
658  /** @} */
659 
660  /** @defgroup xmlWOSD ???_WOSD functions.
661  * @ingroup xmlModify
662  * The strings given as parameters for the "add" and "update" methods that
663  * have a name with
664  * the postfix "_WOSD" (that means "WithOut String Duplication")(for
665  * example "addText_WOSD")
666  * will be free'd by the XMLNode class. For example, it means that this is
667  * incorrect:
668  * \code
669  * xNode.addText_WOSD("foo");
670  * xNode.updateAttribute_WOSD("#newcolor" ,nullptr,"color");
671  * \endcode
672  * In opposition, this is correct:
673  * \code
674  * xNode.addText("foo");
675  * xNode.addText_WOSD(stringDup("foo"));
676  * xNode.updateAttribute("#newcolor" ,nullptr,"color");
677  * xNode.updateAttribute_WOSD(stringDup("#newcolor"),nullptr,"color");
678  * \endcode
679  * Typically, you will never do:
680  * \code
681  * char *b=(char*)malloc(...);
682  * xNode.addText(b);
683  * free(b);
684  * \endcode
685  * ... but rather:
686  * \code
687  * char *b=(char*)malloc(...);
688  * xNode.addText_WOSD(b);
689  * \endcode
690  * ('free(b)' is performed by the XMLNode class)
691  * @{ */
692  static XMLNode createXMLTopNode_WOSD(
693  XMLSTR lpszName,
694  char isDeclaration =
695  FALSE); ///< Create the top node of an XMLNode structure
696  XMLNode addChild_WOSD(
697  XMLSTR lpszName, char isDeclaration = FALSE,
698  XMLElementPosition pos = -1); ///< Add a new child node
699  XMLAttribute* addAttribute_WOSD(
700  XMLSTR lpszName, XMLSTR lpszValue); ///< Add a new attribute
701  XMLCSTR addText_WOSD(
702  XMLSTR lpszValue,
703  XMLElementPosition pos = -1); ///< Add a new text content
704  XMLClear* addClear_WOSD(
705  XMLSTR lpszValue, XMLCSTR lpszOpen = nullptr,
706  XMLCSTR lpszClose = nullptr,
707  XMLElementPosition pos = -1); ///< Add a new clear Tag
708 
709  XMLCSTR updateName_WOSD(XMLSTR lpszName); ///< change node's name
710  XMLAttribute* updateAttribute_WOSD(
711  XMLAttribute* newAttribute,
712  XMLAttribute* oldAttribute); ///< if the attribute to update is
713  /// missing, a new one will be added
714  XMLAttribute* updateAttribute_WOSD(
715  XMLSTR lpszNewValue, XMLSTR lpszNewName = nullptr,
716  int i = 0); ///< if the attribute to update is missing, a new one will
717  /// be added
718  XMLAttribute* updateAttribute_WOSD(
719  XMLSTR lpszNewValue, XMLSTR lpszNewName,
720  XMLCSTR lpszOldName); ///< set lpszNewName=nullptr if you don't want to
721  /// change the name of the attribute if the
722  /// attribute to update is missing, a new one will
723  /// be added
724  XMLCSTR updateText_WOSD(
725  XMLSTR lpszNewValue,
726  int i =
727  0); ///< if the text to update is missing, a new one will be added
728  XMLCSTR updateText_WOSD(
729  XMLSTR lpszNewValue, XMLCSTR lpszOldValue); ///< if the text to update
730  /// is missing, a new one
731  /// will be added
732  XMLClear* updateClear_WOSD(XMLSTR lpszNewContent, int i = 0); ///< if the
733  /// clearTag
734  /// to update
735  /// is
736  /// missing, a
737  /// new one
738  /// will be
739  /// added
740  XMLClear* updateClear_WOSD(XMLClear* newP, XMLClear* oldP); ///< if the
741  /// clearTag to
742  /// update is
743  /// missing, a
744  /// new one will
745  /// be added
746  XMLClear* updateClear_WOSD(
747  XMLSTR lpszNewValue, XMLCSTR lpszOldValue); ///< if the clearTag to
748  /// update is missing, a new
749  /// one will be added
750  /** @} */
751 
752  /** @defgroup xmlPosition Position helper functions (use in conjunction with
753  * the update&add functions
754  * @ingroup xmlModify
755  * These are some useful functions when you want to insert a childNode, a
756  * text or a XMLClearTag in the
757  * middle (at a specified position) of a XMLNode tree already constructed.
758  * The value returned by these
759  * methods is to be used as last parameter (parameter 'pos') of addChild,
760  * addText or addClear.
761  * @{ */
762  XMLElementPosition positionOfText(int i = 0) const;
763  XMLElementPosition positionOfText(XMLCSTR lpszValue) const;
764  XMLElementPosition positionOfClear(int i = 0) const;
765  XMLElementPosition positionOfClear(XMLCSTR lpszValue) const;
766  XMLElementPosition positionOfClear(XMLClear* a) const;
767  XMLElementPosition positionOfChildNode(int i = 0) const;
768  XMLElementPosition positionOfChildNode(XMLNode x) const;
769  XMLElementPosition positionOfChildNode(
770  XMLCSTR name, int i = 0) const; ///< return the position of the ith
771  /// childNode with the specified name if
772  ///(name==nullptr) return the position
773  /// of the ith childNode
774  /** @} */
775 
776  /// Enumeration for XML character encoding.
777  typedef enum XMLCharEncoding {
778  char_encoding_error = 0,
779  char_encoding_UTF8 = 1,
780  char_encoding_legacy = 2,
781  char_encoding_ShiftJIS = 3,
782  char_encoding_GB2312 = 4,
783  char_encoding_Big5 = 5,
784  char_encoding_GBK = 6 // this is actually the same as Big5
785  } XMLCharEncoding;
786 
787  /** \addtogroup conversions
788  * @{ */
789 
790  /// Sets the global options for the conversions
791  static char setGlobalOptions(
793  char guessWideCharChars = 1, char dropWhiteSpace = 1,
795  /**< The "setGlobalOptions" function allows you to change four global
796  * parameters that affect string & file
797  * parsing. First of all, you most-probably will never have to change these
798  * 3 global parameters.
799  *
800  * @param guessWideCharChars If "guessWideCharChars"=1 and if this library
801  * is compiled in WideChar mode, then the
802  * XMLNode::parseFile and XMLNode::openFileHelper functions will test if
803  * the file contains ASCII
804  * characters. If this is the case, then the file will be loaded and
805  * converted in memory to
806  * WideChar before being parsed. If 0, no conversion will be performed.
807  *
808  * @param guessWideCharChars If "guessWideCharChars"=1 and if this library
809  * is compiled in ASCII/UTF8/char* mode, then the
810  * XMLNode::parseFile and XMLNode::openFileHelper functions will test if
811  * the file contains WideChar
812  * characters. If this is the case, then the file will be loaded and
813  * converted in memory to
814  * ASCII/UTF8/char* before being parsed. If 0, no conversion will be
815  * performed.
816  *
817  * @param characterEncoding This parameter is only meaningful when compiling
818  * in char* mode (multibyte character mode).
819  * In wchar_t* (wide char mode), this parameter is ignored. This
820  * parameter should be one of the
821  * three currently recognized encodings: XMLNode::encoding_UTF8,
822  * XMLNode::encoding_ascii,
823  * XMLNode::encoding_ShiftJIS.
824  *
825  * @param dropWhiteSpace In most situations, text fields containing only
826  * white spaces (and carriage returns)
827  * are useless. Even more, these "empty" text fields are annoying
828  * because they increase the
829  * complexity of the user's code for parsing. So, 99% of the time, it's
830  * better to drop
831  * the "empty" text fields. However The XML specification indicates that
832  * no white spaces
833  * should be lost when parsing the file. So to be perfectly
834  * XML-compliant, you should set
835  * dropWhiteSpace=0. A note of caution: if you set "dropWhiteSpace=0",
836  * the parser will be
837  * slower and your code will be more complex.
838  *
839  * @param removeCommentsInMiddleOfText To explain this parameter, let's
840  * consider this code:
841  * \code
842  * XMLNode x=XMLNode::parseString("<a>foo<!-- hello -->bar<!DOCTYPE
843  * world >chu</a>","a");
844  * \endcode
845  * If removeCommentsInMiddleOfText=0, then we will have:
846  * \code
847  * x.getText(0) -> "foo"
848  * x.getText(1) -> "bar"
849  * x.getText(2) -> "chu"
850  * x.getClear(0) --> "<!-- hello -->"
851  * x.getClear(1) --> "<!DOCTYPE world >"
852  * \endcode
853  * If removeCommentsInMiddleOfText=1, then we will have:
854  * \code
855  * x.getText(0) -> "foobar"
856  * x.getText(1) -> "chu"
857  * x.getClear(0) --> "<!DOCTYPE world >"
858  * \endcode
859  *
860  * \return "0" when there are no errors. If you try to set an unrecognized
861  * encoding then the return value will be "1" to signal an error.
862  *
863  * \note Sometime, it's useful to set "guessWideCharChars=0" to disable any
864  * conversion
865  * because the test to detect the file-type (ASCII/UTF8/char* or WideChar)
866  * may fail (rarely). */
867 
868  /// Guess the character encoding of the string (ascii, utf8 or shift-JIS)
869  static XMLCharEncoding guessCharEncoding(
870  void* buffer, int bufLen, char useXMLEncodingAttribute = 1);
871  /**< The "guessCharEncoding" function try to guess the character encoding.
872  * You most-probably will never
873  * have to use this function. It then returns the appropriate value of the
874  * global parameter
875  * "characterEncoding" described in the XMLNode::setGlobalOptions. The guess
876  * is based on the content of a buffer of length
877  * "bufLen" bytes that contains the first bytes (minimum 25 bytes; 200 bytes
878  * is a good value) of the
879  * file to be parsed. The XMLNode::openFileHelper function is using this
880  * function to automatically compute
881  * the value of the "characterEncoding" global parameter. There are several
882  * heuristics used to do the
883  * guess. One of the heuristic is based on the "encoding" attribute. The
884  * original XML specifications
885  * forbids to use this attribute to do the guess but you can still use it if
886  * you set
887  * "useXMLEncodingAttribute" to 1 (this is the default behavior and the
888  * behavior of most parsers).
889  * If an inconsistency in the encoding is detected, then the return value is
890  * "0". */
891  /** @} */
892 
893  private:
894  // these are functions and structures used internally by the XMLNode class
895  // (don't bother about them):
896 
897  typedef struct XMLNodeDataTag // to allow shallow copy and
898  // "intelligent/smart" pointers (automatic
899  // delete):
900  {
901  XMLCSTR lpszName; // Element name (=nullptr if root)
902  int nChild, // Number of child nodes
903  nText, // Number of text fields
904  nClear, // Number of Clear fields (comments)
905  nAttribute; // Number of attributes
906  char isDeclaration; // Whether node is an XML declaration - '<?xml ?>'
908  pParent; // Pointer to parent element (=nullptr if root)
909  XMLNode* pChild; // Array of child nodes
910  XMLCSTR* pText; // Array of text fields
911  XMLClear* pClear; // Array of clear fields
912  XMLAttribute* pAttribute; // Array of attributes
913  int* pOrder; // order of the child_nodes,text_fields,clear_fields
914  int ref_count; // for garbage collection (smart pointers)
915  } XMLNodeData;
917 
918  char parseClearTag(void* px, void* pa);
919  char maybeAddTxT(void* pa, XMLCSTR tokenPStr);
920  int ParseXMLElement(void* pXML);
921  void* addToOrder(
922  int memInc, int* _pos, int nc, void* p, int size, XMLElementType xtype);
923  int indexText(XMLCSTR lpszValue) const;
924  int indexClear(XMLCSTR lpszValue) const;
925  XMLNode addChild_priv(int, XMLSTR, char, int);
926  XMLAttribute* addAttribute_priv(int, XMLSTR, XMLSTR);
927  XMLCSTR addText_priv(int, XMLSTR, int);
928  XMLClear* addClear_priv(int, XMLSTR, XMLCSTR, XMLCSTR, int);
929  void emptyTheNode(char force);
930  static inline XMLElementPosition findPosition(
931  XMLNodeData* d, int index, XMLElementType xtype);
932  static int CreateXMLStringR(
933  XMLNodeData* pEntry, XMLSTR lpszMarker, int nFormat);
934  static int removeOrderElement(XMLNodeData* d, XMLElementType t, int index);
935  static void exactMemory(XMLNodeData* d);
936  static int detachFromParent(XMLNodeData* d);
937 } XMLNode;
938 
939 /// This structure is given by the function XMLNode::enumContents.
940 typedef struct XMLNodeContents
941 {
942  /// This dictates what's the content of the XMLNodeContent
944  /**< should be an union to access the appropriate data. Compiler does not
945  * allow union of object with constructor... too bad. */
950 
952 
953 /** @defgroup StringAlloc String Allocation/Free functions
954  * @ingroup xmlModify
955  * @{ */
956 /// Duplicate (copy in a new allocated buffer) the source string.
957 XMLDLLENTRY XMLSTR stringDup(XMLCSTR source, int cbData = -1);
958 /**< This is
959  * a very handy function when used with all the "XMLNode::*_WOSD" functions
960  * (\link xmlWOSD \endlink).
961  * @param cbData If !=0 then cbData is the number of chars to duplicate. New
962  * strings allocated with
963  * this function should be free'd using the "freeXMLString" function. */
964 
965 /// to free the string allocated inside the "stringDup" function or the
966 /// "createXMLString" function.
967 XMLDLLENTRY void freeXMLString(XMLSTR t); // {free(t);}
968 /** @} */
969 
970 /** @defgroup atoX ato? like functions
971  * @ingroup XMLParserGeneral
972  * The "xmlto?" functions are equivalents to the atoi, atol, atof functions.
973  * The only difference is: If the variable "xmlString" is nullptr, than the
974  * return value
975  * is "defautValue". These 6 functions are only here as "convenience" functions
976  * for the
977  * user (they are not used inside the XMLparser). If you don't need them, you
978  * can
979  * delete them without any trouble.
980  *
981  * @{ */
982 XMLDLLENTRY char xmltob(XMLCSTR xmlString, char defautValue = 0);
983 XMLDLLENTRY int xmltoi(XMLCSTR xmlString, int defautValue = 0);
984 XMLDLLENTRY long xmltol(XMLCSTR xmlString, long defautValue = 0);
985 XMLDLLENTRY double xmltof(XMLCSTR xmlString, double defautValue = .0);
986 XMLDLLENTRY XMLCSTR xmltoa(XMLCSTR xmlString, XMLCSTR defautValue = _CXML(""));
988  xmltoc(XMLCSTR xmlString, XMLCHAR defautValue = _CXML('\0'));
989 /** @} */
990 
991 /** @defgroup ToXMLStringTool Helper class to create XML files using "printf",
992  * "fprintf", "cout",... functions.
993  * @ingroup XMLParserGeneral
994  * @{ */
995 /// Helper class to create XML files using "printf", "fprintf", "cout",...
996 /// functions.
997 /** The ToXMLStringTool class helps you creating XML files using "printf",
998  * "fprintf", "cout",... functions.
999  * The "ToXMLStringTool" class is processing strings so that all the characters
1000  * &,",',<,> are replaced by their XML equivalent:
1001  * \verbatim &amp;, &quot;, &apos;, &lt;, &gt; \endverbatim
1002  * Using the "ToXMLStringTool class" and the "fprintf function" is THE most
1003  * efficient
1004  * way to produce VERY large XML documents VERY fast.
1005  * \note If you are creating from scratch an XML file using the provided XMLNode
1006  * class
1007  * you must not use the "ToXMLStringTool" class (because the "XMLNode" class
1008  * does the
1009  * processing job for you during rendering).*/
1011 {
1012  public:
1013  ToXMLStringTool() : buf(nullptr), buflen(0) {}
1014  ~ToXMLStringTool();
1015  void freeBuffer(); ///<call this function when you have finished using this
1016  /// object to release memory used by the internal buffer.
1017 
1018  XMLSTR toXML(XMLCSTR source); ///< returns a pointer to an internal buffer
1019  /// that contains a XML-encoded string based
1020  /// on the "source" parameter.
1021 
1022  /** The "toXMLUnSafe" function is deprecated because there is a possibility
1023  * of
1024  * "destination-buffer-overflow". It converts the string
1025  * "source" to the string "dest". */
1026  static XMLSTR toXMLUnSafe(
1027  XMLSTR dest, XMLCSTR source); ///< deprecated: use "toXML" instead
1028  static int lengthXMLString(
1029  XMLCSTR source); ///< deprecated: use "toXML" instead
1030 
1031  private:
1033  int buflen;
1034 } ToXMLStringTool;
1035 /** @} */
1036 
1037 /** @defgroup XMLParserBase64Tool Helper class to include binary data inside XML
1038  * strings using "Base64 encoding".
1039  * @ingroup XMLParserGeneral
1040  * @{ */
1041 /// Helper class to include binary data inside XML strings using "Base64
1042 /// encoding".
1043 /** The "XMLParserBase64Tool" class allows you to include any binary data
1044  * (images, sounds,...)
1045  * into an XML document using "Base64 encoding". This class is completely
1046  * separated from the rest of the xmlParser library and can be removed without
1047  * any problem.
1048  * To include some binary data into an XML file, you must convert the binary
1049  * data into
1050  * standard text (using "encode"). To retrieve the original binary data from the
1051  * b64-encoded text included inside the XML file, use "decode". Alternatively,
1052  * these
1053  * functions can also be used to "encrypt/decrypt" some critical data contained
1054  * inside
1055  * the XML (it's not a strong encryption at all, but sometimes it can be
1056  * useful). */
1058 {
1059  public:
1060  XMLParserBase64Tool() : buf(nullptr), buflen(0) {}
1062  void freeBuffer(); ///< Call this function when you have finished using
1063  /// this object to release memory used by the internal
1064  /// buffer.
1065 
1066  /**
1067  * @param formatted If "formatted"=true, some space will be reserved for a
1068  * carriage-return every 72 chars. */
1069  static int encodeLength(int inBufLen, char formatted = 0); ///< return the
1070  /// length of the
1071  /// base64 string
1072  /// that encodes
1073  /// a data buffer
1074  /// of size
1075  /// inBufLen
1076  /// bytes.
1077 
1078  /**
1079  * The "base64Encode" function returns a string containing the base64
1080  * encoding of "inByteLen" bytes
1081  * from "inByteBuf". If "formatted" parameter is true, then there will be a
1082  * carriage-return every 72 chars.
1083  * The string will be free'd when the XMLParserBase64Tool object is deleted.
1084  * All returned strings are sharing the same memory space. */
1085  XMLSTR encode(
1086  unsigned char* inByteBuf, unsigned int inByteLen,
1087  char formatted = 0); ///< returns a pointer to an internal buffer
1088  /// containing the base64 string containing the
1089  /// binary data encoded from "inByteBuf"
1090 
1091  /// returns the number of bytes which will be decoded from "inString".
1092  static unsigned int decodeSize(XMLCSTR inString, XMLError* xe = nullptr);
1093 
1094  /**
1095  * The "decode" function returns a pointer to a buffer containing the binary
1096  * data decoded from "inString"
1097  * The output buffer will be free'd when the XMLParserBase64Tool object is
1098  * deleted.
1099  * All output buffer are sharing the same memory space.
1100  * @param inString If "instring" is malformed, nullptr will be returned */
1101  unsigned char* decode(
1102  XMLCSTR inString, int* outByteLen = nullptr,
1103  XMLError* xe = nullptr); ///< returns a pointer to an internal buffer
1104  /// containing the binary data decoded from
1105  ///"inString"
1106 
1107  /**
1108  * decodes data from "inString" to "outByteBuf". You need to provide the
1109  * size (in byte) of "outByteBuf"
1110  * in "inMaxByteOutBuflen". If "outByteBuf" is not large enough or if data
1111  * is malformed, then "FALSE"
1112  * will be returned; otherwise "TRUE". */
1113  static unsigned char decode(
1114  XMLCSTR inString, unsigned char* outByteBuf, int inMaxByteOutBuflen,
1115  XMLError* xe = nullptr); ///< deprecated.
1116 
1117  private:
1118  void* buf;
1119  int buflen;
1120  void alloc(int newsize);
1122 /** @} */
1123 
1124 #undef XMLDLLENTRY
1125 
1126 #endif
Helper class to create XML files using "printf", "fprintf", "cout",...
Definition: xmlParser.h:1010
XMLElementType
Enumeration used to manage type of data.
Definition: xmlParser.h:265
#define _CXML(c)
Definition: xmlParser.h:225
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:228
enum XMLElementType etype
This dictates what&#39;s the content of the XMLNodeContent.
Definition: xmlParser.h:943
XMLCSTR lpszOpenTag
Definition: xmlParser.h:284
Main Class representing a XML node.
Definition: xmlParser.h:313
int nColumn
Definition: xmlParser.h:277
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:777
struct XMLNodeContents XMLNodeContents
This structure is given by the function XMLNode::enumContents.
Structure for XML clear (unformatted) node (usually comments)
Definition: xmlParser.h:281
This structure is given by the function XMLNode::enumContents.
Definition: xmlParser.h:940
XMLDLLENTRY XMLSTR stringDup(XMLCSTR source, int cbData=-1)
Duplicate (copy in a new allocated buffer) the source string.
Definition: xmlParser.cpp:860
#define XMLCSTR
Definition: xmlParser.h:226
struct XMLClear XMLClear
Structure for XML clear (unformatted) node (usually comments)
static XMLClear emptyXMLClear
Definition: xmlParser.h:522
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:916
#define XMLDLLENTRY
Definition: xmlParser.h:185
struct XMLResults XMLResults
Structure used to obtain error details if the parse fails.
struct XMLAttribute XMLAttribute
Structure for XML attribute.
XMLNode()
Definition: xmlParser.h:520
GLuint index
Definition: glext.h:4054
XMLError
Enumeration for XML parse errors.
Definition: xmlParser.h:238
XMLDLLENTRY XMLCSTR xmltoa(XMLCSTR xmlString, XMLCSTR defautValue=_CXML(""))
Definition: xmlParser.cpp:510
#define XMLSTR
Definition: xmlParser.h:227
static XMLNode::XMLCharEncoding characterEncoding
Definition: xmlParser.cpp:33
XMLCSTR lpszValue
Definition: xmlParser.h:283
XMLAttribute * pAttribute
Definition: xmlParser.h:912
static char dropWhiteSpace
Definition: xmlParser.cpp:34
struct XMLNode::XMLNodeDataTag XMLNodeData
struct XMLNodeDataTag * pParent
Definition: xmlParser.h:907
static XMLAttribute emptyXMLAttribute
Definition: xmlParser.h:523
XMLCSTR lpszName
Definition: xmlParser.h:291
int XMLElementPosition
XMLElementPosition are not interchangeable with simple indexes.
Definition: xmlParser.h:296
XMLNode child
Definition: xmlParser.h:946
Helper class to include binary data inside XML strings using "Base64 encoding".
Definition: xmlParser.h:1057
XMLAttribute attrib
Definition: xmlParser.h:947
#define FALSE
Definition: xmlParser.h:231
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:949
GLsizei GLsizei GLchar * source
Definition: glext.h:4082
Structure for XML attribute.
Definition: xmlParser.h:289
static char guessWideCharChars
Definition: xmlParser.cpp:34
XMLCSTR lpszValue
Definition: xmlParser.h:292
enum XMLError error
Definition: xmlParser.h:276
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:948
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:285
Structure used to obtain error details if the parse fails.
Definition: xmlParser.h:274
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: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020