00001 #include <spl/xml/xpath/private/XPathOpAttrib.h> 00002 #include <spl/xml/XmlElement.h> 00003 #include <spl/xml/XmlNode.h> 00004 00005 XPathOpAttrib::XPathOpAttrib() 00006 { 00007 } 00008 00009 XPathOpAttrib::XPathOpAttrib(const XPathOpAttrib& op) 00010 { 00011 } 00012 00013 XPathOpAttrib::~XPathOpAttrib() 00014 { 00015 } 00016 00017 XPathOpAttrib& XPathOpAttrib::operator =(const XPathOpAttrib& oproot) 00018 { 00019 return *this; 00020 } 00021 00022 bool XPathOpAttrib::IsMatch(XmlNode& context) 00023 { 00024 return context.IsElement() && context.ToElement()->Attributes()->Count() > 0; 00025 } 00026 00027 XmlNodeListPtr XPathOpAttrib::NextContext(XmlNodePtr context) 00028 { 00029 ASSERT(IsMatch(context)); 00030 XmlNodeListPtr nodes(new XmlNodeList()); 00031 00032 XmlElementPtr node(context->ToElement()); 00033 int count = node->Attributes()->Count(); 00034 00035 for (int x = 0; x < count; x++) 00036 { 00037 nodes->Add(node->Attribute(x)); 00038 } 00039 00040 return nodes; 00041 } 00042 00043 #if defined(DEBUG) || defined(_DEBUG) 00044 void XPathOpAttrib::CheckMem() const 00045 { 00046 XPathOperator::CheckMem(); 00047 } 00048 00049 void XPathOpAttrib::ValidateMem() const 00050 { 00051 XPathOperator::ValidateMem(); 00052 } 00053 #endif