xml UPDATE backup/restore input line
diff --git a/src/xml.c b/src/xml.c
index aa35fb4..1204d13 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -1184,8 +1184,9 @@
         xmlctx->dynamic = 0;
     }
 
-    /* backup in current pointer only */
-    backup->in = (void *)xmlctx->in->current;
+    /* backup in */
+    backup->b_current = xmlctx->in->current;
+    backup->b_line = xmlctx->in->line;
 
     /* duplicate elements */
     backup->elements.objs = malloc(xmlctx->elements.size * sizeof(struct lyxml_elem));
@@ -1220,8 +1221,9 @@
     /* free ns */
     lyxml_ns_rm_all(xmlctx);
 
-    /* restore in current pointer */
-    xmlctx->in->current = (void *)backup->in;
+    /* restore in */
+    xmlctx->in->current = backup->b_current;
+    xmlctx->in->line = backup->b_line;
     backup->in = xmlctx->in;
 
     /* restore backup */
diff --git a/src/xml.h b/src/xml.h
index 125271f..8c8c516 100644
--- a/src/xml.h
+++ b/src/xml.h
@@ -1,9 +1,10 @@
 /**
  * @file xml.h
  * @author Radek Krejci <rkrejci@cesnet.cz>
+ * @author Michal Vasko <mvasko@cesnet.cz>
  * @brief Generic XML parser routines.
  *
- * Copyright (c) 2015 - 2018 CESNET, z.s.p.o.
+ * Copyright (c) 2015 - 2022 CESNET, z.s.p.o.
  *
  * This source code is licensed under BSD 3-Clause License (the "License").
  * You may not use this file except in compliance with the License.
@@ -100,6 +101,10 @@
 
     struct ly_set elements; /* list of not-yet-closed elements */
     struct ly_set ns;       /* handled with LY_SET_OPT_USEASLIST */
+
+    /* backup in members */
+    const char *b_current;
+    uint64_t b_line;
 };
 
 /**