void DomCharacterData::insert_data(unsigned long offset, const DomString &arg) { if (impl) { DomString value = impl->get_tree_node()->get_node_value(); if (offset > value.length()) offset = value.length(); impl->get_tree_node()->node_value = value.substr(0, offset) + arg + value.substr(offset); } }
void DomCharacterData::delete_data(unsigned long offset, unsigned long count) { if (impl) { DomString value = impl->get_tree_node()->get_node_value(); if (offset > value.length()) offset = value.length(); if (offset + count > value.length()) count = value.length() - offset; if (count == 0) return; if (count < value.length()) { value = value.substr(0, offset) + value.substr(offset + count); } else { value = DomString(); } impl->get_tree_node()->node_value = value; } }