bool ZLXMLReader::NamespaceAttributeNamePredicate::accepts(const ZLXMLReader &reader, const char *name) const {
	const std::map<std::string,std::string> &namespaces = reader.namespaces();
	for (std::map<std::string,std::string>::const_iterator it = namespaces.begin(); it != namespaces.end(); ++it) {
		if (it->second == myNamespaceName) {
			return it->first + ':' + myAttributeName == name;
		}
	}
	return false;
}
Exemple #2
0
bool ZLXMLReader::FullNamePredicate::accepts(const ZLXMLReader &reader, const std::string &name) const {
	const std::size_t index = name.find(':');
	const std::string namespaceId =
		index == std::string::npos ? std::string() : name.substr(0, index);

	const nsMap &namespaces = reader.namespaces();
	nsMap::const_iterator it = namespaces.find(namespaceId);
	return
		it != namespaces.end() &&
		it->second == myNamespaceName &&
		name.substr(index + 1) == myName;
}