summaryrefslogtreecommitdiff
path: root/core/fxcrt/xml/cfx_xmlelement.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcrt/xml/cfx_xmlelement.h')
-rw-r--r--core/fxcrt/xml/cfx_xmlelement.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/fxcrt/xml/cfx_xmlelement.h b/core/fxcrt/xml/cfx_xmlelement.h
index 0d3468aba4..394866042c 100644
--- a/core/fxcrt/xml/cfx_xmlelement.h
+++ b/core/fxcrt/xml/cfx_xmlelement.h
@@ -60,4 +60,10 @@ inline CFX_XMLElement* ToXMLElement(CFX_XMLNode* pNode) {
: nullptr;
}
+inline const CFX_XMLElement* ToXMLElement(const CFX_XMLNode* pNode) {
+ return pNode && pNode->GetType() == FX_XMLNODE_Element
+ ? static_cast<const CFX_XMLElement*>(pNode)
+ : nullptr;
+}
+
#endif // CORE_FXCRT_XML_CFX_XMLELEMENT_H_