A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/node__manip_8cpp_source.html below:

NCBI C++ ToolKit: src/misc/xmlwrapp/node_manip.cpp Source File

51 #include <libxml/tree.h> 55

xmlNodePtr new_xml_node = xmlCopyNode(to_add, 1);

56  if

(!new_xml_node)

throw

std::bad_alloc();

59  if

(xmlAddChild(parent, new_xml_node) == 0) {

60

xmlFreeNode(new_xml_node);

61  throw xml::exception

(

"failed to insert xml::node; xmlAddChild failed"

);

64  if

(xmlAddPrevSibling(before, new_xml_node) == 0) {

65

xmlFreeNode(new_xml_node);

66  throw xml::exception

(

"failed to insert xml::node; xmlAddPrevSibling failed"

);

69  if

(!new_xml_node->ns) new_xml_node->ns = xmlSearchNs(

NULL

, parent,

NULL

);

76

xmlNodePtr copied_node = xmlCopyNode(new_node, 1);

77  if

(!copied_node)

throw

std::bad_alloc();

83

xmlDocPtr temp_to_test_replace_success = xmlNewDoc((

const

xmlChar *)(

"1.0"

));

84  if

(!temp_to_test_replace_success) {

85

xmlFreeNode(copied_node);

86  throw

std::bad_alloc();

90

copied_node->doc = temp_to_test_replace_success;

91

xmlReplaceNode(old_node, copied_node);

93  if

(copied_node->doc == temp_to_test_replace_success) {

94

xmlFreeDoc(temp_to_test_replace_success);

95

xmlFreeNode(copied_node);

96  throw xml::exception

(

"failed to replace xml::node; xmlReplaceNode() failed"

);

99

xmlFreeDoc(temp_to_test_replace_success);

100

xmlFreeNode(old_node);

102  if

(!copied_node->ns) copied_node->ns = xmlSearchNs(

NULL

, copied_node->parent,

NULL

);

109

xmlNodePtr after = to_erase->next;

111

xmlUnlinkNode(to_erase);

112

xmlFreeNode(to_erase);

118  if

(!

node

->ns)

node

->ns = default_ns;

123  if

(!

node

->ns)

node

->ns = default_ns;

130  if

(!

node

||!

node

->nsDef)

return false

;

131

xmlNs * current(

node

->nsDef);

133  if

(!current->prefix)

return true

;

134

current = current->next;

140  if

(!

node

)

return false

;

143  if

(

node

->ns ==

ns

)

return true

;

146  for

(xmlAttrPtr current =

node

->properties; current; current = current->next)

147  if

(current->ns ==

ns

)

return true

;

158  if

(!

node

)

return

;

163  if

(!

node

->ns || !

node

->ns->prefix)

171  if

(!

node

->nsDef)

return

;

172  if

(

node

->nsDef != definition) {

174  while

(

prev

&&

prev

->next != definition)

176  if

(!

prev

)

return

;

177  prev

->next = definition->next;

180  node

->nsDef = definition->next;

182

xmlFreeNs(definition);

186

xmlNs *current(

node

->nsDef);

188  if

(!prefix && !current->prefix)

return

current;

189  if

(prefix && current->prefix) {

190  if

(xmlStrEqual(

reinterpret_cast<const

xmlChar*

>

(prefix), current->prefix))

193

current = current->next;

202

xmlNs *current(

node

->nsDef);

204  if

(!current->prefix)

206

current = current->next;

212  if

(!

node

)

return

;

215  if

(

node

->ns == oldNs)

node

->ns = newNs;

218  for

(xmlAttrPtr current =

node

->properties; current; current = current->next)

219  if

(current->ns == oldNs) {

221  if

(newNs && newNs->prefix)

This exception class is thrown by xmlwrapp for all runtime XML-related errors along with the xml::par...

The xml::node class is used to hold information about one XML node.

iterator parent(void)

Get an iterator that points at the parent of this node.

The xml::ns class is used to access and handle namespaces of nodes and attributes.

static DLIST_TYPE *DLIST_NAME() prev(DLIST_LIST_TYPE *list, DLIST_TYPE *item)

This file contains the definition of the xml::exception class.

xmlNodePtr node_replace(xmlNodePtr old_node, xmlNodePtr new_node)

Replace a node with another one.

void erase_ns_definition(xmlNodePtr node, xmlNsPtr definition)

Erases namespace definition in the node.

xmlNsPtr lookup_default_ns_above(xmlNodePtr node)

Searches for a default namspace definition in the given node and above.

xmlNodePtr node_erase(xmlNodePtr to_erase)

Erase a node from the child list, and then free it from memory.

void set_children_default_ns(xmlNodePtr node, xmlNsPtr default_ns)

Set the node and its children default namespace to the given.

void update_children_default_ns(xmlNodePtr node, xmlNsPtr newns)

Replaces the node and its children default namespace with the given.

bool is_ns_used(xmlNodePtr node, xmlNsPtr ns)

Check if the node, attributes and children use the namespace.

void replace_ns(xmlNodePtr node, xmlNsPtr oldNs, xmlNsPtr newNs)

Replaces old namspace with a new one in nodes and attributes all the way down in the hierarchy.

bool has_default_ns_definition(xmlNodePtr node)

Check if the node holds default namespace definition.

xmlNodePtr node_insert(xmlNodePtr parent, xmlNodePtr before, xmlNodePtr to_add)

Insert a node somewhere in the child list of a parent node.

xmlNsPtr lookup_ns_definition(xmlNodePtr node, const char *prefix)

Searches for a namspace definition in the given node.

This file contains the definition of the xml::node manipulation functions.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4