00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00031
00032 #pragma once
00033
00034 #include "../api_core.h"
00035 #include "../System/sharedptr.h"
00036 #include "dom_string.h"
00037
00038 class CL_DomElement;
00039 class CL_DomAttr;
00040 class CL_DomText;
00041 class CL_DomCDATASection;
00042 class CL_DomEntityReference;
00043 class CL_DomEntity;
00044 class CL_DomProcessingInstruction;
00045 class CL_DomComment;
00046 class CL_DomDocument;
00047 class CL_DomDocumentType;
00048 class CL_DomDocumentFragment;
00049 class CL_DomNotation;
00050 class CL_DomNodeList;
00051 class CL_DomNamedNodeMap;
00052 class CL_DomNode_Generic;
00053
00069 class CL_API_CORE CL_DomNode
00070 {
00073
00074 public:
00075 CL_DomNode();
00076
00080 CL_DomNode(const CL_DomNode ©);
00081
00082 ~CL_DomNode();
00083
00087
00088 public:
00090 enum NodeType
00091 {
00092 NULL_NODE = 0,
00093 ELEMENT_NODE = 1,
00094 ATTRIBUTE_NODE = 2,
00095 TEXT_NODE = 3,
00096 CDATA_SECTION_NODE = 4,
00097 ENTITY_REFERENCE_NODE = 5,
00098 ENTITY_NODE = 6,
00099 PROCESSING_INSTRUCTION_NODE = 7,
00100 COMMENT_NODE = 8,
00101 DOCUMENT_NODE = 9,
00102 DOCUMENT_TYPE_NODE = 10,
00103 DOCUMENT_FRAGMENT_NODE = 11,
00104 NOTATION_NODE = 12
00105 };
00106
00108
00123 CL_DomString get_node_name() const;
00124
00126 CL_DomString get_namespace_uri() const;
00127
00129
00132 CL_DomString get_prefix() const;
00133
00135
00142 void set_prefix(const CL_DomString &prefix);
00143
00145
00148 CL_DomString get_local_name() const;
00149
00151
00166 CL_DomString get_node_value() const;
00167
00169 void set_node_value(const CL_DomString &value);
00170
00172 unsigned short get_node_type() const;
00173
00175
00178 CL_DomNode get_parent_node() const;
00179
00181
00187 CL_DomNodeList get_child_nodes() const;
00188
00190
00191 CL_DomNode get_first_child() const;
00192
00194
00195 CL_DomNode get_last_child() const;
00196
00198
00199 CL_DomNode get_previous_sibling() const;
00200
00202
00203 CL_DomNode get_next_sibling() const;
00204
00206 CL_DomNamedNodeMap get_attributes() const;
00207
00209
00210 CL_DomDocument get_owner_document() const;
00211
00213 bool is_null() const;
00214
00216 bool is_element() const;
00217
00219 bool is_attr() const;
00220
00222 bool is_text() const;
00223
00225 bool is_cdata_section() const;
00226
00228 bool is_entity_reference() const;
00229
00231 bool is_entity() const;
00232
00234 bool is_processing_instruction() const;
00235
00237 bool is_comment() const;
00238
00240 bool is_document() const;
00241
00243 bool is_document_type() const;
00244
00246 bool is_document_fragment() const;
00247
00249 bool is_notation() const;
00250
00252 bool is_supported(const CL_DomString &feature, const CL_DomString &version) const;
00253
00255 bool has_attributes() const;
00256
00258 bool has_child_nodes() const;
00259
00263
00264 public:
00266
00269 CL_DomNode &operator =(const CL_DomNode ©);
00270
00272 bool operator ==(const CL_DomNode &other) const;
00273
00275
00285 void normalize();
00286
00288
00294 CL_DomNode insert_before(CL_DomNode &new_child, CL_DomNode &ref_child);
00295
00297
00301 CL_DomNode replace_child(CL_DomNode &new_child, CL_DomNode &old_child);
00302
00304 CL_DomNode remove_child(CL_DomNode &old_child);
00305
00307
00308 CL_DomNode append_child(CL_DomNode new_child);
00309
00311
00318 CL_DomNode clone_node(bool deep) const;
00319
00321
00322 CL_DomElement to_element() const;
00323
00325
00326 CL_DomAttr to_attr() const;
00327
00329
00330 CL_DomText to_text() const;
00331
00333
00334 CL_DomCDATASection to_cdata_section() const;
00335
00337
00338 CL_DomEntityReference to_entity_reference() const;
00339
00341
00342 CL_DomEntity to_entity() const;
00343
00345
00346 CL_DomProcessingInstruction to_processing_instruction() const;
00347
00349
00350 CL_DomComment to_comment() const;
00351
00353
00354 CL_DomDocument to_document() const;
00355
00357
00358 CL_DomDocumentType to_document_type() const;
00359
00361
00362 CL_DomDocumentFragment to_document_fragment() const;
00363
00365
00366 CL_DomNotation to_notation() const;
00367
00369
00370 CL_DomNode named_item(const CL_DomString &name) const;
00371
00373 CL_DomNode named_item_ns(
00374 const CL_DomString &namespace_uri,
00375 const CL_DomString &local_name) const;
00376
00378 CL_DomString find_namespace_uri(const CL_DomString &qualified_name) const;
00379
00381 CL_DomString find_prefix(const CL_DomString &namespace_uri) const;
00382
00384 std::vector<CL_DomNode> select_nodes(const CL_DomString &xpath_expression) const;
00385
00387 CL_DomNode select_node(const CL_DomString &xpath_expression) const;
00388
00390 CL_String select_string(const CL_DomString &xpath_expression) const;
00391
00393 int select_int(const CL_DomString &xpath_expression) const;
00394
00396 float select_float(const CL_DomString &xpath_expression) const;
00397
00399 bool select_bool(const CL_DomString &xpath_expression) const;
00400
00404
00405 protected:
00406
00411 CL_DomNode(CL_DomDocument doc, unsigned short node_type);
00412
00416 CL_DomNode(const CL_SharedPtr<CL_DomNode_Generic> &impl);
00417
00418 CL_SharedPtr<CL_DomNode_Generic> impl;
00419
00420 friend class CL_DomDocument;
00421
00422 friend class CL_DomNamedNodeMap;
00424 };
00425