aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/xml/document/node-attr.h
diff options
context:
space:
mode:
Diffstat (limited to 'library/cpp/xml/document/node-attr.h')
-rw-r--r--library/cpp/xml/document/node-attr.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/library/cpp/xml/document/node-attr.h b/library/cpp/xml/document/node-attr.h
index 1378ffdfbf..6f5445d4c2 100644
--- a/library/cpp/xml/document/node-attr.h
+++ b/library/cpp/xml/document/node-attr.h
@@ -45,6 +45,18 @@ namespace NXml {
}
template <class T>
+ TMaybe<T> TNode::TryAttr(TZtStringBuf name) const {
+ TCharPtr value(xmlGetProp(NodePointer, XMLCHAR(name.c_str())));
+ if (!value) {
+ return Nothing();
+ }
+
+ T t;
+ AttrInternal(value, t, name);
+ return t;
+ }
+
+ template <class T>
T TNode::Attr(TZtStringBuf name, const T& defvalue) const {
TCharPtr attr(xmlGetProp(NodePointer, XMLCHAR(name.c_str())));
if (!attr) {