pElement->Value() might return NULL which doesn't work well with std::string. You should probably use ValueStr().