Example #1
0
void XMLReader::parserRootElement(uint32_t depth)
{
	LPCWSTR  pwszLocalName, aValue, aName,nameSpace;
	uint32_t  uCounter;

	this->pReader->GetLocalName(&pwszLocalName, NULL);
	this->pReader->GetPrefix(&nameSpace, NULL);
	this->pReader->GetValue(&aValue, NULL);
	
   //Set Element
	root = new  XMLElement(pwszLocalName);
	root->setPrefix(nameSpace);
	root->setZIndex(depth);

	if (aValue != L"")
	{
		root->setText(aValue);
	}

	//move to the first attribute of the element and parser it 
	HRESULT hr= this->pReader->MoveToFirstAttribute();
	while (hr == S_OK)
	{
	    this->pReader->GetPrefix(&nameSpace, NULL);
		this->pReader->GetLocalName(&pwszLocalName, NULL);
		this->pReader->GetValue(&aValue, NULL);
		//set the attribute values
		XMLAttribute *attribute = new  XMLAttribute(pwszLocalName);
		attribute->setValue(aValue);
		attribute->setPrefix(nameSpace);
		this->root->addAttribute(attribute);

		hr = this->pReader->MoveToFirstAttribute();
	}

}