1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464
|
<html>
<head>
<title>~/src/firstworks/rudiments-0.31/include/rudiments/xmldomnode.h.html</title>
<meta name="Generator" content="Vim/7.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#ffffff" text="#000000">
<pre>
<font color="#0000ff">// Copyright (c) 2002 David Muse</font>
<font color="#0000ff">// See the COPYING file for more information.</font>
<font color="#a020f0">#ifndef RUDIMENTS_XMLDOMNODE_H</font>
<font color="#a020f0">#define RUDIMENTS_XMLDOMNODE_H</font>
<font color="#a020f0">#include </font><font color="#ff00ff"><rudiments/private/xmldomnodeincludes.h></font>
<font color="#0000ff">// The xmldomnode class provides a generic container for DOM tree elements.</font>
<font color="#0000ff">// One can navigate the nodes of the tree, modify the tree and read or modify</font>
<font color="#0000ff">// the data that the nodes contain by calling methods in this class.</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// A DOM tree node can be one of the following:</font>
<font color="#0000ff">// the document root</font>
<font color="#0000ff">// a tag </font>
<font color="#0000ff">// a tag attribute</font>
<font color="#0000ff">// a segment of text</font>
<font color="#0000ff">// a comment</font>
<font color="#0000ff">// a segment of CDATA</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// Each node may contain the following data, though for some node types, the</font>
<font color="#0000ff">// data container is unused:</font>
<font color="#0000ff">// type</font>
<font color="#0000ff">// name</font>
<font color="#0000ff">// value</font>
<font color="#0000ff">// parent node</font>
<font color="#0000ff">// next sibling</font>
<font color="#0000ff">// previous sibling</font>
<font color="#0000ff">// a list of attribute nodes</font>
<font color="#0000ff">// a list of child nodes</font>
<font color="#0000ff">// </font>
<font color="#0000ff">// Here is a breakdown by node type:</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// For the document root:</font>
<font color="#0000ff">// type - ROOT_XMLDOMNODETYPE</font>
<font color="#0000ff">// name - "document"</font>
<font color="#0000ff">// value - unused</font>
<font color="#0000ff">// parent node - unused</font>
<font color="#0000ff">// next sibling - unused</font>
<font color="#0000ff">// previous sibling - unused</font>
<font color="#0000ff">// a list of attribute nodes - unused</font>
<font color="#0000ff">// a list of child nodes - the xml version tag, the doctype tag</font>
<font color="#0000ff">// and the top-level enclosing tag</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// For a tag:</font>
<font color="#0000ff">// type - TAG_XMLDOMNODETYPE</font>
<font color="#0000ff">// name - the tag name</font>
<font color="#0000ff">// value - unused</font>
<font color="#0000ff">// parent node - the parent tag or document root</font>
<font color="#0000ff">// next sibling - can be another tag, a segment of text,</font>
<font color="#0000ff">// a comment or a segment of cdata</font>
<font color="#0000ff">// previous sibling - can be another tag, a segment of text,</font>
<font color="#0000ff">// a comment or a segment of cdata</font>
<font color="#0000ff">// a list of attribute nodes - a list of attribute nodes</font>
<font color="#0000ff">// a list of child nodes - a list of tags, text segments, comments</font>
<font color="#0000ff">// and/or cdata segments</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// For a tag attribute:</font>
<font color="#0000ff">// type - ATTRIBUTE_XMLDOMNODETYPE</font>
<font color="#0000ff">// name - the attribute name</font>
<font color="#0000ff">// value - the attribute value</font>
<font color="#0000ff">// (note that for tags with standalone</font>
<font color="#0000ff">// attributes, the name and value are the same)</font>
<font color="#0000ff">// parent node - the tag containing the attributes</font>
<font color="#0000ff">// next sibling - the next attribute</font>
<font color="#0000ff">// previous sibling - the previous attribute</font>
<font color="#0000ff">// a list of attribute nodes - unused</font>
<font color="#0000ff">// a list of child nodes - unused</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// For a segment of text:</font>
<font color="#0000ff">// type - TEXT_XMLDOMNODETYPE</font>
<font color="#0000ff">// name - "text"</font>
<font color="#0000ff">// value - the text itself</font>
<font color="#0000ff">// parent node - the tag containing the text</font>
<font color="#0000ff">// next sibling - can be a tag, a comment or a segment of cdata</font>
<font color="#0000ff">// previous sibling - can be a tag, a comment or a segment of cdata</font>
<font color="#0000ff">// a list of attribute nodes - unused</font>
<font color="#0000ff">// a list of child nodes - unused</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// For a comment:</font>
<font color="#0000ff">// type - COMMENT_XMLDOMNODETYPE</font>
<font color="#0000ff">// name - "comment"</font>
<font color="#0000ff">// value - the comment itself</font>
<font color="#0000ff">// parent node - the tag containing the comment</font>
<font color="#0000ff">// next sibling - can be a tag, a segment of text, another</font>
<font color="#0000ff">// comment or a segment of cdata</font>
<font color="#0000ff">// previous sibling - can be a tag, a segment of text, another</font>
<font color="#0000ff">// comment or a segment of cdata</font>
<font color="#0000ff">// a list of attribute nodes - unused</font>
<font color="#0000ff">// a list of child nodes - unused</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// For a segment of cdata:</font>
<font color="#0000ff">// type - CDATA_XMLDOMNODETYPE</font>
<font color="#0000ff">// name - "cdata"</font>
<font color="#0000ff">// value - the cdata itself</font>
<font color="#0000ff">// parent node - the tag containing the cdata</font>
<font color="#0000ff">// next sibling - can be a tag, a segment of text, a comment</font>
<font color="#0000ff">// or another segment of cdata</font>
<font color="#0000ff">// previous sibling - can be a tag, a segment of text, a comment</font>
<font color="#0000ff">// or another segment of cdata</font>
<font color="#0000ff">// a list of attribute nodes - unused</font>
<font color="#0000ff">// a list of child nodes - unused</font>
<font color="#a020f0">#ifdef RUDIMENTS_NAMESPACE</font>
<font color="#2e8b57"><b>namespace</b></font> rudiments {
<font color="#a020f0">#endif</font>
<font color="#0000ff">// node types</font>
<font color="#2e8b57"><b>enum</b></font> xmldomnodetype {
NULL_XMLDOMNODETYPE=<font color="#ff00ff">0</font>,
ROOT_XMLDOMNODETYPE,
TAG_XMLDOMNODETYPE,
ATTRIBUTE_XMLDOMNODETYPE,
TEXT_XMLDOMNODETYPE,
COMMENT_XMLDOMNODETYPE,
CDATA_XMLDOMNODETYPE
};
<font color="#2e8b57"><b>class</b></font> xmldom;
<font color="#2e8b57"><b>class</b></font> xmldomnodeprivate;
<font color="#2e8b57"><b>class</b></font> xmldomnode {
<font color="#a52a2a"><b>public</b></font>:
xmldomnode(xmldom *dom, xmldomnode *nullnode);
<font color="#0000ff">// Creates a new node and intializes its</font>
<font color="#0000ff">// member variables to NULL.</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// Your application should pass in a special</font>
<font color="#0000ff">// "nullnode" which may be created by the</font>
<font color="#0000ff">// static method createNullNode() below.</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// This will keep command chaining like this:</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// mynode->getChild("node1")-></font>
<font color="#0000ff">// getChild("node2")->getName("node3");</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// from causing the program to crash trying to</font>
<font color="#0000ff">// dereference a NULL pointer if, for example,</font>
<font color="#0000ff">// "node2" doesn't exist.</font>
xmldomnode(xmldom *dom,
xmldomnode *nullnode,
xmldomnodetype type,
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *name, <font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *value);
<font color="#0000ff">// Creates a new node (as above) and intializes</font>
<font color="#0000ff">// its member variables to the values passed in.</font>
~xmldomnode();
<font color="#0000ff">// Deletes the node, all attribute nodes and</font>
<font color="#0000ff">// optionally all child nodes, recursively.</font>
<font color="#2e8b57"><b>static</b></font> xmldomnode *createNullNode(xmldom *dom);
<font color="#0000ff">// Creates a special "null node" whose</font>
<font color="#0000ff">// parent, next sibling and previous</font>
<font color="#0000ff">// siblings point back to itself.</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// This special node should be passed</font>
<font color="#0000ff">// in when creating new xmldomnodes.</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// This method allocates xmldomnode</font>
<font color="#0000ff">// internally and passes a pointer</font>
<font color="#0000ff">// back. The calling program must</font>
<font color="#0000ff">// ultimately deallocate the node.</font>
<font color="#0000ff">// These methods control the behavior when the node is deleted.</font>
<font color="#2e8b57"><b>void</b></font> cascadeOnDelete();
<font color="#0000ff">// Instructs the destructor to recursively</font>
<font color="#0000ff">// delete all child nodes. (the default)</font>
<font color="#2e8b57"><b>void</b></font> dontCascadeOnDelete();
<font color="#0000ff">// Instructs the destructor not to recursively</font>
<font color="#0000ff">// delete all child nodes.</font>
<font color="#0000ff">// These methods provide read-access to the data</font>
<font color="#0000ff">// contained in the node.</font>
xmldomnodetype getType() <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns the node type.</font>
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *getName() <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns the node name.</font>
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *getValue() <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns the node value.</font>
xmldomnode *getParent() <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns a pointer to the parent node or the</font>
<font color="#0000ff">// nullnode if none exists.</font>
xmldomnode *getPreviousSibling() <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns a pointer to the previous sibling</font>
<font color="#0000ff">// node or the nullnode if none exists.</font>
xmldomnode *getPreviousTagSibling() <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns a pointer to the previous sibling</font>
<font color="#0000ff">// node whose type is TAG_XMLDOMNODE. If no</font>
<font color="#0000ff">// match is found, nullnode is returned.</font>
xmldomnode *getPreviousTagSibling(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *name) <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns the previous sibling node named</font>
<font color="#0000ff">// "name" whose type is TAG_XMLDOMNODE or the</font>
<font color="#0000ff">// nullnode if not found.</font>
xmldomnode *getPreviousTagSibling(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *name,
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *attributename,
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *attributevalue) <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns the previous sibling node named</font>
<font color="#0000ff">// "name" with an attribute named</font>
<font color="#0000ff">// "attributename" with value "attributevalue"</font>
<font color="#0000ff">// whose type is TAG_XMLDOMNODE. If "name" is</font>
<font color="#0000ff">// null, then the name of the child node is not</font>
<font color="#0000ff">// checked, and the first child node with any</font>
<font color="#0000ff">// name (with matching attribute name/value)</font>
<font color="#0000ff">// will be returned. If no match is found,</font>
<font color="#0000ff">// nullnode is returned.</font>
xmldomnode *getNextSibling() <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns a pointer to the next sibling node</font>
<font color="#0000ff">// or the nullnode if none exists.</font>
xmldomnode *getNextTagSibling() <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns a pointer to the next sibling node</font>
<font color="#0000ff">// whose type is TAG_XMLDOMNODE. If no match</font>
<font color="#0000ff">// is found, nullnode is returned.</font>
xmldomnode *getNextTagSibling(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *name) <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns the next sibling node named "name"</font>
<font color="#0000ff">// whose type is TAG_XMLDOMNODE or the nullnode</font>
<font color="#0000ff">// if not found.</font>
xmldomnode *getNextTagSibling(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *name,
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *attributename,
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *attributevalue) <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns the next sibling node named "name"</font>
<font color="#0000ff">// with an attribute named "attributename" with</font>
<font color="#0000ff">// value "attributevalue" whose type is</font>
<font color="#0000ff">// TAG_XMLDOMNODE. If "name" is null,</font>
<font color="#0000ff">// then the name of the child node is not</font>
<font color="#0000ff">// checked, and the first child node with any</font>
<font color="#0000ff">// name (with matching attribute name/value)</font>
<font color="#0000ff">// will be returned. If no match is found,</font>
<font color="#0000ff">// nullnode is returned.</font>
<font color="#2e8b57"><b>int</b></font> getChildCount() <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns the number of immediate child nodes.</font>
xmldomnode *getChild(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *name) <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns the child node named "name"</font>
<font color="#0000ff">// or the nullnode if not found.</font>
xmldomnode *getChild(<font color="#2e8b57"><b>int</b></font> position) <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns the child node at index "position"</font>
<font color="#0000ff">// or the nullnode if not found.</font>
xmldomnode *getChild(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *name,
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *attributename,
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *attributevalue)
<font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns the first child node named "name"</font>
<font color="#0000ff">// with an attribute named "attributename" with</font>
<font color="#0000ff">// value "attributevalue". If "name" is null,</font>
<font color="#0000ff">// then the name of the child node is not</font>
<font color="#0000ff">// checked, and the first child node with any</font>
<font color="#0000ff">// name (with matching attribute name/value)</font>
<font color="#0000ff">// will be returned. If no match is found,</font>
<font color="#0000ff">// nullnode is returned.</font>
xmldomnode *getFirstTagChild() <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns the first child node whose type is</font>
<font color="#0000ff">// TAG_XMLDOMNODE. If no match is found,</font>
<font color="#0000ff">// nullnode is returned.</font>
xmldomnode *getFirstTagChild(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *name) <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns the first child node named "name"</font>
<font color="#0000ff">// whose type is TAG_XMLDOMNODE. If no match</font>
<font color="#0000ff">// is found, nullnode is returned.</font>
xmldomnode *getFirstTagChild(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *name,
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *attributename,
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *attributevalue)
<font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns the first child node named "name"</font>
<font color="#0000ff">// with an attribute named "attributename" with</font>
<font color="#0000ff">// value "attributevalue" whose type is</font>
<font color="#0000ff">// TAG_XMLDOMNODE. If "name" is null,</font>
<font color="#0000ff">// then the name of the child node is not</font>
<font color="#0000ff">// checked, and the first child node with any</font>
<font color="#0000ff">// name (with matching attribute name/value)</font>
<font color="#0000ff">// will be returned. If no match is found,</font>
<font color="#0000ff">// nullnode is returned.</font>
<font color="#2e8b57"><b>int</b></font> getAttributeCount() <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns the number of attributes.</font>
xmldomnode *getAttribute(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *name) <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns the attribute named "name"</font>
<font color="#0000ff">// or the nullnode if not found.</font>
xmldomnode *getAttribute(<font color="#2e8b57"><b>int</b></font> position) <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns the attribute node at index</font>
<font color="#0000ff">// "position" or the nullnode if not found.</font>
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *getAttributeValue(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *name) <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns the value of the attribute named</font>
<font color="#0000ff">// "name" or the nullnode if not found.</font>
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *getAttributeValue(<font color="#2e8b57"><b>int</b></font> position) <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns the value of the attribute node at</font>
<font color="#0000ff">// index "position" or the nullnode if not</font>
<font color="#0000ff">// found.</font>
constnamevaluepairs *getAttributes() <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns the attribute names and values in</font>
<font color="#0000ff">// a constnamevaluepairs dictionary. The</font>
<font color="#0000ff">// instance of constnamevaluepairs is allocated</font>
<font color="#0000ff">// internally and must be deleted by the</font>
<font color="#0000ff">// calling program. Returns NULL if the node</font>
<font color="#0000ff">// is a nullNode and an empty dictionary if the</font>
<font color="#0000ff">// node has no attributes.</font>
xmldomnode *getNullNode() <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns the nullnode used by this node.</font>
<font color="#2e8b57"><b>bool</b></font> isNullNode() <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns true if this node is the special</font>
<font color="#0000ff">// nullnode and false otherwise.</font>
<font color="#0000ff">// These methods provide write-access to the data contained in</font>
<font color="#0000ff">// the node. These methods can also be used to move nodes</font>
<font color="#0000ff">// around in the tree, and insert or delete them.</font>
<font color="#2e8b57"><b>void</b></font> setType(xmldomnodetype type);
<font color="#0000ff">// Sets the node type to "type".</font>
<font color="#2e8b57"><b>void</b></font> setName(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *name);
<font color="#0000ff">// Sets the node name to "name".</font>
<font color="#2e8b57"><b>void</b></font> setValue(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *value);
<font color="#0000ff">// Sets the node value to "value".</font>
<font color="#2e8b57"><b>void</b></font> setParent(xmldomnode *parent);
<font color="#0000ff">// Sets the parent of the node to "parent".</font>
<font color="#2e8b57"><b>void</b></font> setPreviousSibling(xmldomnode *previous);
<font color="#0000ff">// Sets the previous sibling of the node to "previous".</font>
<font color="#2e8b57"><b>void</b></font> setNextSibling(xmldomnode *next);
<font color="#0000ff">// Sets the next sibling of the node to "next".</font>
<font color="#2e8b57"><b>bool</b></font> insertChild(xmldomnode *child, <font color="#2e8b57"><b>int</b></font> position);
<font color="#0000ff">// Inserts "child" into the list of child nodes at</font>
<font color="#0000ff">// "position". The position of the next sibling</font>
<font color="#0000ff">// (and all successive siblings) is incremented.</font>
<font color="#2e8b57"><b>bool</b></font> appendChild(xmldomnode *child);
<font color="#0000ff">// Appends "child" to the list of child nodes.</font>
<font color="#2e8b57"><b>bool</b></font> deleteChild(<font color="#2e8b57"><b>int</b></font> position);
<font color="#0000ff">// Deletes the child node at "position". The position</font>
<font color="#0000ff">// of the next sibling (and all successive siblings)</font>
<font color="#0000ff">// is decremented.</font>
<font color="#2e8b57"><b>bool</b></font> deleteChild(xmldomnode *child);
<font color="#0000ff">// Searches the list of child nodes for "child" and</font>
<font color="#0000ff">// deletes it. The position of the next sibling (and</font>
<font color="#0000ff">// all successive siblings) is decremented.</font>
<font color="#2e8b57"><b>bool</b></font> insertText(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *value, <font color="#2e8b57"><b>int</b></font> position);
<font color="#0000ff">// Inserts a child node of type TEXT_XMLDOMNODE with</font>
<font color="#0000ff">// value "value" into the list of child nodes at</font>
<font color="#0000ff">// "position". The position of the next sibling</font>
<font color="#0000ff">// (and all successive siblings) is incremented.</font>
<font color="#2e8b57"><b>bool</b></font> appendText(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *value);
<font color="#0000ff">// Appends a child node of type TEXT_XMLDOMNODE with</font>
<font color="#0000ff">// value "value" to the list of child nodes.</font>
<font color="#2e8b57"><b>bool</b></font> insertAttribute(xmldomnode *attribute, <font color="#2e8b57"><b>int</b></font> position);
<font color="#0000ff">// Inserts "attribute" into the list of attributes at</font>
<font color="#0000ff">// "position". The position of the next attribute</font>
<font color="#0000ff">// (and all successive attributes) is incremented.</font>
<font color="#2e8b57"><b>bool</b></font> appendAttribute(xmldomnode *attribute);
<font color="#0000ff">// Appends "attribute" to the list of attributes.</font>
<font color="#2e8b57"><b>bool</b></font> insertAttribute(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *name, <font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *value,
<font color="#2e8b57"><b>int</b></font> position);
<font color="#0000ff">// Creates an attribute node with "name" and "value"</font>
<font color="#0000ff">// and inserts it into the list of attributes at</font>
<font color="#0000ff">// "position". The position of the next attribute</font>
<font color="#0000ff">// (and all successive attributes) is incremented.</font>
<font color="#2e8b57"><b>bool</b></font> appendAttribute(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *name, <font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *value);
<font color="#0000ff">// Creates an attribute node with "name" and "value"</font>
<font color="#0000ff">// and appends it to the list of attributes.</font>
<font color="#2e8b57"><b>bool</b></font> deleteAttribute(<font color="#2e8b57"><b>int</b></font> position);
<font color="#0000ff">// Deletes the attribute at "position". The position</font>
<font color="#0000ff">// of the next attribute (and all successive attributes)</font>
<font color="#0000ff">// is decremented.</font>
<font color="#2e8b57"><b>bool</b></font> deleteAttribute(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *name);
<font color="#0000ff">// Searches the list of attribute nodes for an attribute</font>
<font color="#0000ff">// named "name" and deletes it. The position of the</font>
<font color="#0000ff">// next attribute (and all successive attributes) is</font>
<font color="#0000ff">// decremented.</font>
<font color="#2e8b57"><b>bool</b></font> deleteAttribute(xmldomnode *attribute);
<font color="#0000ff">// Searches the list of attribute nodes for "attribute"</font>
<font color="#0000ff">// and deletes it. The position of the next attribute</font>
<font color="#0000ff">// (and all successive attributes) is decremented.</font>
stringbuffer *xml() <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Allocates a stringbuffer, writes a textual</font>
<font color="#0000ff">// representation of the tree starting at this</font>
<font color="#0000ff">// node to it and returns the stringbuffer;</font>
<font color="#0000ff">// The calling program must deallocate the</font>
<font color="#0000ff">// stringbuffer.</font>
stringbuffer *getPath() <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// If the xmldomnode is an element, returns the</font>
<font color="#0000ff">// "path" of the xmldomnode. The path will have</font>
<font color="#0000ff">// the following form:</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// /element[index]/element[index]/...</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// The return value is allocated inside the</font>
<font color="#0000ff">// method and must be deallocated by the calling</font>
<font color="#0000ff">// program.</font>
xmldomnode *getChildByPath(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *path) <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns the child element with "path" of the</font>
<font color="#0000ff">// form:</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// /element[index]/element[index]/...</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// Returns the null node if the specified</font>
<font color="#0000ff">// element was not found.</font>
xmldomnode *getAttributeByPath(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *path,
<font color="#2e8b57"><b>int</b></font> position) <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns the attribute node at index</font>
<font color="#0000ff">// "position" of the child element with "path"</font>
<font color="#0000ff">// of the form:</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// /element[index]/element[index]/...</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// Returns the null node if the specified</font>
<font color="#0000ff">// element was not found.</font>
xmldomnode *getAttributeByPath(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *path,
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *name) <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns the attribute node named "name"</font>
<font color="#0000ff">// of the child element with "path" of the form:</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// /element[index]/element[index]/...</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// Returns the null node if the specified</font>
<font color="#0000ff">// element was not found.</font>
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *getAttributeValueByPath(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *path,
<font color="#2e8b57"><b>int</b></font> position) <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns the value of the attribute at index</font>
<font color="#0000ff">// "position" of the child element with "path"</font>
<font color="#0000ff">// of the form:</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// /element[index]/element[index]/...</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// Returns the null node if the specified</font>
<font color="#0000ff">// element was not found.</font>
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *getAttributeValueByPath(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *path,
<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *name) <font color="#2e8b57"><b>const</b></font>;
<font color="#0000ff">// Returns the value of the attribute named</font>
<font color="#0000ff">// "name" of the child element with "path" of</font>
<font color="#0000ff">// the form:</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// /element[index]/element[index]/...</font>
<font color="#0000ff">//</font>
<font color="#0000ff">// Returns the null node if the specified</font>
<font color="#0000ff">// element was not found.</font>
<font color="#a020f0"> #include </font><font color="#ff00ff"><rudiments/private/xmldomnode.h></font>
};
<font color="#a020f0">#ifdef RUDIMENTS_NAMESPACE</font>
}
<font color="#a020f0">#endif</font>
<font color="#a020f0">#endif</font>
</pre>
</body>
</html>
|