---
Product: Aspose.Cells
Platform: cpp
Page Type: reference
Canonical URL: https://reference.aspose.org/cells/cpp/xmlelement
---

# XmlElement

## Overview

`XmlElement` is a class in Aspose.Cells FOSS for C++.

Lightweight handle to an XML element. Default-constructed instances are null.

This class declares 16 methods for XmlElement objects in C++ programs.
Available methods include: `AddChild`, `GetAttribute`, `GetAttributes`, `GetChildNodes`, `GetDescendantsAndSelf`, `GetElement`, `GetElements`, `GetName`, `GetValue`, `IsNull`, `IsTextNode`, `MakeElement`, and 1 additional methods.
Public members are accessible to any C++ application after installing the Aspose.Cells FOSS for C++ package.

## Methods

| Signature | Description |
|-----------|-------------|
| `IsNull()` → `bool` | Returns true if null is set. |
| `GetName()` → `std::string` | Gets the qualified name in Clark notation {uri}localname. |
| `GetValue()` → `std::string` | Gets the concatenated text of all descendant text nodes. |
| `IsTextNode()` → `bool` | Returns true if this node represents a text node rather than an element. |
| `GetAttributes()` → `std::vector<std::pair<std::string, std::string>>` | Gets all attributes as local-name/value pairs. |
| `GetChildNodes()` → `std::vector<XmlElement>` | Gets all direct child nodes (elements and text nodes). |
| `GetAttribute(localName: std::string_view)` → `XmlAttribute` | Gets an attribute by local name. Returns a null XmlAttribute if not found. |
| `GetElements(qualifiedName: std::string_view)` → `std::vector<XmlElement>` | Gets all direct child elements with the given qualified name. |
| `GetElement(qualifiedName: std::string_view)` → `XmlElement` | Gets the first direct child element with the given qualified name. |
| `GetDescendantsAndSelf()` → `std::vector<XmlElement>` | Gets all descendant elements including self, in document order. |
| `MakeElement(node: std::shared_ptr<XmlNodeData>)` → `XmlElement` | Calls MakeElement(node) on this XmlElement instance. |
| `MakeElement(qualifiedName: std::string)` → `XmlElement` | Creates a new element with the given qualified name and no attributes or children. |
| `MakeElement(qualifiedName: std::string, attributes: std::vector<std::pair<std::string, std::string>>, children: std::vector<XmlElement>)` → `XmlElement` | Creates a new element with the given qualified name, attributes, and child elements. |
| `AddChild(child: XmlElement)` | Adds a child element to this element. |
| `AddChild(child: XmlElement)` | Adds a child element by moving. |
| `SetAttribute(localName: std::string_view, value: std::string)` | Sets an attribute value, adding it if absent or updating if present. |

## See Also

- [Aspose.Cells — Enterprise API Reference](https://reference.aspose.com/cells/)