Пример #1
0
void CL_DomElement::set_child_string_ns(const CL_DomString &namespace_uri, const CL_DomString &qualified_name, const CL_DomString &value)
{
	CL_DomString local_name;
	CL_DomString::size_type pos = qualified_name.find(L':');
	if (pos != CL_DomString::npos)
		local_name = qualified_name.substr(pos+1);
	else
		local_name = qualified_name;

	CL_DomElement element = named_item_ns(namespace_uri, local_name).to_element();
	if (element.is_null())
	{
		element = get_owner_document().create_element_ns(namespace_uri, qualified_name);
		append_child(element);
	}

	CL_DomText dom_text = get_owner_document().create_text_node(value);
	if (element.get_first_child().is_text())
	{
		CL_DomNode temp_domnode = element.get_first_child();
		replace_child(dom_text, temp_domnode);
	}
	else
	{
		element.append_child(dom_text);
	}
}
Пример #2
0
void CL_DomElement::set_child_string(const CL_DomString &name, const CL_DomString &value)
{
	CL_DomElement element = named_item(name).to_element();
	if (element.is_null())
	{
		element = get_owner_document().create_element(name);
		append_child(element);
	}

	while (!element.get_first_child().is_null())
	{
		CL_DomNode my_child = element.get_first_child();
		element.remove_child(my_child);
	}

	CL_DomText dom_text = get_owner_document().create_text_node(value);
	element.append_child(dom_text);
}
Пример #3
0
void CL_DomElement::set_attribute(const CL_DomString &name, const CL_DomString &value)
{
	if (impl)
	{
		CL_DomNamedNodeMap attributes = get_attributes();
		CL_DomAttr attribute = attributes.get_named_item(name).to_attr();
		if (attribute.is_attr())
		{
			attribute.set_node_value(value);
		}
		else
		{
			attribute = get_owner_document().create_attribute(name);
			attribute.set_node_value(value);
			attributes.set_named_item(attribute);
		}
	}
}
Пример #4
0
	void DomElement::set_attribute_ns(
		const DomString &namespace_uri,
		const DomString &qualified_name,
		const DomString &value)
	{
		if (impl)
		{
			DomNamedNodeMap attributes = get_attributes();
			DomAttr attribute = attributes.get_named_item_ns(namespace_uri, qualified_name).to_attr();
			if (attribute.is_attr())
			{
				attribute.set_node_value(value);
			}
			else
			{
				attribute = get_owner_document().create_attribute_ns(namespace_uri, qualified_name);
				attribute.set_node_value(value);
				attributes.set_named_item_ns(attribute);
			}
		}
	}