00001 #include <spl/xml/xpath/private/XPathOpChildern.h> 00002 00003 XPathOpChildern::XPathOpChildern(const String& name) 00004 : m_name(name) 00005 { 00006 } 00007 00008 XPathOpChildern::XPathOpChildern() 00009 : m_name() 00010 { 00011 } 00012 00013 XPathOpChildern::XPathOpChildern(const XPathOpChildern& op) 00014 : m_name(op.m_name) 00015 { 00016 } 00017 00018 XPathOpChildern::~XPathOpChildern() 00019 { 00020 } 00021 00022 XPathOpChildern& XPathOpChildern::operator =(const XPathOpChildern& oproot) 00023 { 00024 m_name = oproot.m_name; 00025 return *this; 00026 } 00027 00028 bool XPathOpChildern::IsMatch(XmlNode& context) 00029 { 00030 return context.HasChildNodes(); 00031 } 00032 00033 XmlNodeListPtr XPathOpChildern::NextContext(XmlNodePtr context) 00034 { 00035 ASSERT(IsMatch(context)); 00036 XmlNodeListPtr childs(context->ChildNodes()); 00037 00038 if (m_name.Length() == 0) 00039 { 00040 return childs; 00041 } 00042 00043 XmlNodeListPtr nodes = XmlNodeListPtr(new XmlNodeList()); 00044 00045 for ( int x = 0; x < childs->Count(); x++ ) 00046 { 00047 if (childs->Item(x)->Name() == m_name) 00048 { 00049 nodes->Add(childs->Item(x)); 00050 } 00051 } 00052 00053 return nodes; 00054 } 00055 00056 #if defined(DEBUG) || defined(_DEBUG) 00057 void XPathOpChildern::CheckMem() const 00058 { 00059 XPathOperator::CheckMem(); 00060 } 00061 00062 void XPathOpChildern::ValidateMem() const 00063 { 00064 XPathOperator::ValidateMem(); 00065 } 00066 #endif