bool DomImplementation::has_feature(
		const DomString &feature,
		const DomString &version)
	{
		if (StringHelp::compare(feature, "xml") == 0 && (version == "1.0" || version.empty()))
			return true;
		if (StringHelp::compare(feature, "xml") == 0 && (version == "2.0" || version.empty()))
			return true;
		return false;
	}
示例#2
0
	float DomElement::get_attribute_float_ns(const DomString &namespace_uri, const DomString &local_name, float default_value) const
	{
		DomString value = get_attribute_ns(namespace_uri, local_name);
		if (!value.empty())
			return StringHelp::text_to_float(value);
		else
			return default_value;
	}
示例#3
0
	float DomElement::get_attribute_float(const DomString &name, float default_value) const
	{
		DomString value = get_attribute(name);
		if (!value.empty())
			return StringHelp::text_to_float(value);
		else
			return default_value;
	}
示例#4
0
	bool DomElement::get_attribute_bool_ns(const DomString &namespace_uri, const DomString &local_name, bool default_value) const
	{
		DomString value = get_attribute_ns(namespace_uri, local_name);
		if (!value.empty())
			return value == "true";
		else
			return default_value;
	}
示例#5
0
	bool DomElement::get_attribute_bool(const DomString &name, bool default_value) const
	{
		DomString value = get_attribute(name);
		if (!value.empty())
			return value == "true";
		else
			return default_value;
	}
示例#6
0
	int DomElement::get_child_int_ns(const DomString &namespace_uri, const DomString &local_name, int default_value) const
	{
		DomString value = get_child_string_ns(namespace_uri, local_name);
		if (!value.empty())
			return StringHelp::text_to_int(value);
		else
			return default_value;
	}
示例#7
0
	int DomElement::get_child_int(const DomString &name, int default_value) const
	{
		DomString value = get_child_string(name);
		if (!value.empty())
			return StringHelp::text_to_int(value);
		else
			return default_value;
	}
示例#8
0
	bool DomNode::is_supported(
		const DomString &feature,
		const DomString &version) const
	{
		if (StringHelp::compare(feature, "xml") == 0)
		{
			if (version.empty() || version == "1.0" || version == "2.0")
				return true;
		}
		return false;
	}
示例#9
0
	DomString DomNode::find_namespace_uri(const DomString &qualified_name) const
	{
		static DomString xmlns_prefix("xmlns:");
		static DomString xmlns_xml("xml");
		static DomString xmlns_xml_uri("http://www.w3.org/XML/1998/namespace");
		static DomString xmlns_xmlns("xmlns");
		static DomString xmlns_xmlns_uri("http://www.w3.org/2000/xmlns/");

		DomString prefix;
		DomString::size_type pos = qualified_name.find(':');
		if (pos != DomString::npos)
			prefix = qualified_name.substr(0, pos);

		if (prefix == xmlns_xml)
			return xmlns_xml;
		else if (prefix == xmlns_xmlns || qualified_name == xmlns_xmlns)
			return xmlns_xmlns;

		DomDocument_Impl *doc_impl = (DomDocument_Impl *)impl->owner_document.lock().get();
		const DomTreeNode *cur = impl->get_tree_node();
		while (cur)
		{
			const DomTreeNode *cur_attr = cur->get_first_attribute(doc_impl);
			while (cur_attr)
			{
				std::string node_name = cur_attr->get_node_name();
				if (prefix.empty())
				{
					if (node_name == xmlns_xmlns)
						return cur_attr->get_node_value();
				}
				else
				{
					if (node_name.substr(0, 6) == xmlns_prefix && node_name.substr(6) == prefix)
						return cur_attr->get_node_value();
				}
				cur_attr = cur_attr->get_next_sibling(doc_impl);
			}
			cur = cur->get_parent(doc_impl);
		}
		return DomString();
	}