From 24e1dc8723aea1e46a3aa15794747f3fa52f8eca Mon Sep 17 00:00:00 2001 From: crupest Date: Mon, 24 Jan 2022 22:14:37 +0800 Subject: ... --- src/xml/XmlNode.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/xml/XmlNode.cpp') diff --git a/src/xml/XmlNode.cpp b/src/xml/XmlNode.cpp index 5c6294c8..79847544 100644 --- a/src/xml/XmlNode.cpp +++ b/src/xml/XmlNode.cpp @@ -32,6 +32,15 @@ void XmlElementNode::AddChild(XmlNode* child) { child->parent_ = this; } +XmlElementNode* XmlElementNode::GetFirstChildElement() const { + for (auto child : children_) { + if (child->GetType() == XmlNode::Type::Element) { + return child->AsElement(); + } + } + return nullptr; +} + XmlNode* XmlElementNode::Clone() const { XmlElementNode* node = new XmlElementNode(tag_, attributes_); -- cgit v1.2.3