コード例 #1
0
ファイル: xmldom.cpp プロジェクト: zhuxiaokun/workshop
XMLNodeColl XMLElementNode::QueryChildren(const char* path)
{
	KXmlString tagName;

	int beg = 0;
	int nameLen;
	int len = (int)strlen(path);

	XMLElementNode* pRoot = this;
	XMLElementNode* pElem = pRoot;

	while(beg < len)
	{
		const char* pSep = strchr(path+beg, '/');
		if(pSep)
		{
			nameLen = int(pSep - path) - beg;
			tagName.assign(path+beg, nameLen);
			pElem = pElem->GetChild(tagName.c_str());
			if(!pElem) return XMLNodeColl();
		}
		else
		{
			nameLen = len - beg;
			tagName.assign(path+beg, nameLen);
			return pElem->GetChildren(tagName.c_str());
		}
		beg += nameLen + 1;
	}
	return XMLNodeColl();
}