]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/xmlnode.tex
documented GetResourcesDir() and GetLocalizedResourcesDir() (somehow forgot to commit...
[wxWidgets.git] / docs / latex / wx / xmlnode.tex
1 \section{\class{wxXmlNode}}\label{wxxmlnode}
2
3 Represents a node in an XML document. See \helpref{wxXmlDocument}{wxxmldocument}.
4
5 Node has a name and may have content
6 and properties. Most common node types are {\tt wxXML\_TEXT\_NODE} (name and
7 properties are irrelevant) and {\tt wxXML\_ELEMENT\_NODE} (e.g. in {\tt <title>hi</title>} there is
8 an element with name="title", irrelevant content and one child ({\tt wxXML\_TEXT\_NODE}
9 with content="hi").
10
11 If wxUSE\_UNICODE is 0, all strings are encoded in the encoding given to Load
12 (default is UTF-8).
13
14
15 \wxheading{Derived from}
16
17 No base class
18
19 \wxheading{Include files}
20
21 <wx/xml/xml.h>
22
23 \wxheading{Constants}
24
25 The following are the node types supported by wxXmlNode:
26
27 {\small
28 \begin{verbatim}
29 enum wxXmlNodeType
30 {
31 wxXML_ELEMENT_NODE,
32 wxXML_ATTRIBUTE_NODE,
33 wxXML_TEXT_NODE,
34 wxXML_CDATA_SECTION_NODE,
35 wxXML_ENTITY_REF_NODE,
36 wxXML_ENTITY_NODE,
37 wxXML_PI_NODE,
38 wxXML_COMMENT_NODE,
39 wxXML_DOCUMENT_NODE,
40 wxXML_DOCUMENT_TYPE_NODE,
41 wxXML_DOCUMENT_FRAG_NODE,
42 wxXML_NOTATION_NODE,
43 wxXML_HTML_DOCUMENT_NODE
44 }
45 \end{verbatim}
46 }
47
48 \wxheading{See also}
49
50 \helpref{wxXmlDocument}{wxxmldocument}, \helpref{wxXmlProperty}{wxxmlproperty}
51
52
53 \latexignore{\rtfignore{\wxheading{Members}}}
54
55
56 \membersection{wxXmlNode::wxXmlNode}\label{wxxmlnodewxxmlnode}
57
58
59 \func{}{wxXmlNode}{\param{wxXmlNode* }{parent}, \param{wxXmlNodeType }{type}, \param{const wxString\& }{name}, \param{const wxString\& }{content = wxEmptyString}, \param{wxXmlProperty* }{props = NULL}, \param{wxXmlNode* }{next = NULL}}
60
61 \wxheading{Parameters}
62
63 \docparam{parent}{The parent node. Can be NULL.}
64 \docparam{type}{One of the wxXmlNodeType enumeration value.}
65 \docparam{name}{The name of the node. This is the string which appears between angular brackets.}
66 \docparam{content}{The content of the node. Only meaningful when {\it type} is {\tt wxXML\_TEXT\_NODE} or {\tt wxXML\_CDATA\_SECTION\_NODE}.}
67 \docparam{props}{If not NULL, this wxXmlProperty object and its eventual siblings are attached to
68 the node.}
69 \docparam{next}{If not NULL, this node and its eventual siblings are attached to
70 the node.}
71
72 \func{}{wxXmlNode}{\param{const wxXmlNode\& }{node}}
73
74 Copy constructor. Note that this does NOT copy syblings
75 and parent pointer, i.e. \helpref{GetParent()}{wxxmlnodegetparent} and \helpref{GetNext()}{wxxmlnodegetnext} will return NULL
76 after using copy ctor and are never unmodified by operator=.
77
78 On the other hand, it DOES copy children and properties.
79
80
81 \func{}{wxXmlNode}{\param{wxXmlNodeType }{type}, \param{const wxString\& }{name}, \param{const wxString\& }{content = wxEmptyString}}
82
83 A simplified version of the first constructor form.
84
85
86 \membersection{wxXmlNode::\destruct{wxXmlNode}}\label{wxxmlnodedtor}
87
88 \func{}{\destruct{wxXmlNode}}{\void}
89
90 The virtual destructor. Deletes attached children and properties.
91
92 \membersection{wxXmlNode::AddChild}\label{wxxmlnodeaddchild}
93
94 \func{void}{AddChild}{\param{wxXmlNode* }{child}}
95
96 Adds the given node as child of this node. To attach a second children to this node, use the
97 \helpref{SetNext()}{wxxmlnodesetnext} function of the {\it child} node.
98
99 \membersection{wxXmlNode::AddProperty}\label{wxxmlnodeaddproperty}
100
101 \func{void}{AddProperty}{\param{const wxString\& }{name}, \param{const wxString\& }{value}}
102
103 Appends a property with given {\it name} and {\it value} to the list of properties for this node.
104
105 \func{void}{AddProperty}{\param{wxXmlProperty* }{prop}}
106
107 Appends the given property to the list of properties for this node.
108
109 \membersection{wxXmlNode::DeleteProperty}\label{wxxmlnodedeleteproperty}
110
111 \func{bool}{DeleteProperty}{\param{const wxString\& }{name}}
112
113 Removes the first properties which has the given {\it name} from the list of properties for this node.
114
115 \membersection{wxXmlNode::GetChildren}\label{wxxmlnodegetchildren}
116
117 \constfunc{wxXmlNode*}{GetChildren}{\void}
118
119 Returns the first child of this node.
120 To get a pointer to the second child of this node (if it does exist), use the
121 \helpref{GetNext()}{wxxmlnodegetnext} function on the returned value.
122
123 \membersection{wxXmlNode::GetContent}\label{wxxmlnodegetcontent}
124
125 \constfunc{wxString}{GetContent}{\void}
126
127 Returns the content of this node. Can be an empty string.
128
129 \membersection{wxXmlNode::GetName}\label{wxxmlnodegetname}
130
131 \constfunc{wxString}{GetName}{\void}
132
133 Returns the name of this node. Can be an empty string (e.g. for nodes of type {\tt wxXML\_TEXT\_NODE} or {\tt wxXML\_CDATA\_SECTION\_NODE}).
134
135 \membersection{wxXmlNode::GetNext}\label{wxxmlnodegetnext}
136
137 \constfunc{wxXmlNode*}{GetNext}{\void}
138
139 Returns a pointer to the sibling of this node or NULL if there are no siblings.
140
141 \membersection{wxXmlNode::GetParent}\label{wxxmlnodegetparent}
142
143 \constfunc{wxXmlNode*}{GetParent}{\void}
144
145 Returns a pointer to the parent of this node or NULL if this node has no parent.
146
147 \membersection{wxXmlNode::GetPropVal}\label{wxxmlnodegetpropval}
148
149 \constfunc{bool}{GetPropVal}{\param{const wxString\& }{propName}, \param{wxString* }{value}}
150
151 Returns \true if a property named {\it propName} could be found.
152 If the {\it value} pointer is not NULL, the value of that property is saved there.
153
154 \constfunc{wxString}{GetPropVal}{\param{const wxString\& }{propName}, \param{const wxString\& }{defaultVal}}
155
156 Returns the value of the property named {\it propName} if it does exist.
157 If it does not exist, the {\it defaultVal} is returned.
158
159 \membersection{wxXmlNode::GetProperties}\label{wxxmlnodegetproperties}
160
161 \constfunc{wxXmlProperty*}{GetProperties}{\void}
162
163 Return a pointer to the first property of this node.
164
165 \membersection{wxXmlNode::GetType}\label{wxxmlnodegettype}
166
167 \constfunc{wxXmlNodeType}{GetType}{\void}
168
169 Returns the type of this node.
170
171
172 \membersection{wxXmlNode::HasProp}\label{wxxmlnodehasprop}
173
174 \constfunc{bool}{HasProp}{\param{const wxString\& }{propName}}
175
176 Returns \true if this node has a property named {\it propName}.
177
178 \membersection{wxXmlNode::InsertChild}\label{wxxmlnodeinsertchild}
179
180 \func{void}{InsertChild}{\param{wxXmlNode* }{child}, \param{wxXmlNode* }{before\_node}}
181
182 Inserts the {\it child} node after {\it before\_node} in the children list.
183
184 \membersection{wxXmlNode::RemoveChild}\label{wxxmlnoderemovechild}
185
186 \func{bool}{RemoveChild}{\param{wxXmlNode* }{child}}
187
188 Removes the given node from the children list. Returns \true if the node was found and removed
189 or \false if the node could not be found.
190
191 \membersection{wxXmlNode::SetChildren}\label{wxxmlnodesetchildren}
192
193 \func{void}{SetChildren}{\param{wxXmlNode* }{child}}
194
195 Sets as first child the given node. The caller is responsible to delete any previously present
196 children node.
197
198 \membersection{wxXmlNode::SetContent}\label{wxxmlnodesetcontent}
199
200 \func{void}{SetContent}{\param{const wxString\& }{con}}
201
202 Sets the content of this node.
203
204 \membersection{wxXmlNode::SetName}\label{wxxmlnodesetname}
205
206 \func{void}{SetName}{\param{const wxString\& }{name}}
207
208 Sets the name of this node.
209
210 \membersection{wxXmlNode::SetNext}\label{wxxmlnodesetnext}
211
212 \func{void}{SetNext}{\param{wxXmlNode* }{next}}
213
214 Sets as sibling the given node. The caller is responsible to delete any previously present
215 sibling node.
216
217 \membersection{wxXmlNode::SetParent}\label{wxxmlnodesetparent}
218
219 \func{void}{SetParent}{\param{wxXmlNode* }{parent}}
220
221 Sets as parent the given node. The caller is responsible to delete any previously present
222 parent node.
223
224 \membersection{wxXmlNode::SetProperties}\label{wxxmlnodesetproperties}
225
226 \func{void}{SetProperties}{\param{wxXmlProperty* }{prop}}
227
228 Sets as first property the given wxXmlProperty object.
229 The caller is responsible to delete any previously present properties attached to this node.
230
231 \membersection{wxXmlNode::SetType}\label{wxxmlnodesettype}
232
233 \func{void}{SetType}{\param{wxXmlNodeType }{type}}
234
235 Sets the type of this node.
236
237 \membersection{wxXmlNode::operator=}\label{wxxmlnodeoperatorassign}
238
239 \func{wxXmlNode\& operator}{operator=}{\param{const wxXmlNode\& }{node}}
240
241 See the copy constructor for more info.
242