HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UT_XMLNode.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_XMLNode.h ( Library, C++)
7  *
8  * COMMENTS:
9  * The XML node uses the libxml2 API documented at:
10  * http://xmlsoft.org/html/libxml-tree.html#xmlNode
11  *
12  */
13 
14 #ifndef __UT_XMLNode__
15 #define __UT_XMLNode__
16 
17 #include "UT_API.h"
18 #include "UT_ValArray.h"
19 #include "UT_String.h"
20 
21 // When compiling a library as static, we need to define LIBXML_STATIC
22 #if !defined(LIBXML_STATIC) && defined(MAKING_STATIC)
23 #define LIBXML_STATIC
24 #endif
25 #include <libxml/tree.h>
26 
27 struct _xmlNode;
28 typedef struct _xmlNode *xmlNodePtr;
29 
30 class UT_XMLNode;
32 
33 // Enumeration of different XML node types.
34 // http://xmlsoft.org/html/libxml-tree.html#xmlElementType
35 typedef xmlElementType UT_XMLNodeType;
36 #define UT_XML_NO_NODETYPE 0
37 
39 {
40 public:
41  /// Constructor.
42  explicit UT_XMLNode(xmlNodePtr node);
43 
44  /// Destructor.
45  ~UT_XMLNode();
46 
47  /// Return the node name.
48  const UT_String &getName();
49 
50  /// Return the list of children
51  const UT_XMLNodeList &getChildren();
52 
53  /// Return the contents of the node.
54  /// Return an empty string if this is not a contents node.
55  const UT_String &getContents();
56 
57  /// Return the line number that this node appears in
58  /// in the file or in memory.
59  int getLineNumber() const;
60 
61 private:
62  xmlNodePtr myNode;
63  UT_String myName;
64  UT_String myContents;
65  UT_XMLNodeList myChildren;
66 };
67 
68 #endif
69 
struct _xmlNode * xmlNodePtr
Definition: UT_XMLNode.h:28
#define UT_API
Definition: UT_API.h:12
xmlElementType UT_XMLNodeType
Definition: UT_XMLNode.h:35
UT_ValArray< UT_XMLNode * > UT_XMLNodeList
Definition: UT_XMLNode.h:30