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 provides 16 methods for working with XmlElement objects in C++ programs. Available methods include: AddChild, GetAttribute, GetAttributes, GetChildNodes, GetDescendantsAndSelf, GetElement, GetElements, GetName, GetValue, IsNull, IsTextNode, MakeElement, and 1 additional methods. All public members are accessible to any C++ application after installing the Aspose.Cells FOSS for C++ package.

Methods

SignatureDescription
IsNull() → boolReturns true if null is set.
GetName() → std::stringGets the qualified name in Clark notation {uri}localname.
GetValue() → std::stringGets the concatenated text of all descendant text nodes.
IsTextNode() → boolReturns 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) → XmlAttributeGets 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) → XmlElementGets 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>) → XmlElementCalls MakeElement on this XmlElement instance.
MakeElement(qualifiedName: std::string) → XmlElementCreates 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>) → XmlElementCreates 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

 English