tests CHANGE enhance xml test for getting string data

Includes small bugfixes in function itself to conform the test
diff --git a/src/xml.c b/src/xml.c
index 796fee1..78b259f 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -246,13 +246,15 @@
 /**
  * @brief Parse input as XML text (attribute's values and element's content).
  *
- * Mixed content of XML elements is not allowed.
+ * Mixed content of XML elements is not allowed. Formating whitespaces before child element are ignored,
+ * LY_EINVAL is returned in such a case (buffer is not filled, no error is printed) and input is moved
+ * to the beginning of a child definition.
  *
  * In the case of attribute's values, the input string is expected to start on a quotation mark to
- * select which delimiter (single or double quote) is used. Otherwise, the element content is beeing
+ * select which delimiter (single or double quote) is used. Otherwise, the element content is being
  * parsed expected to be terminated by '<' character.
  *
- * If function succeedes, the string in output buffer is always NULL-terminated.
+ * If function succeeds, the string in output buffer is always NULL-terminated.
  *
  * @param[in] context XML context to track lines or store errors into libyang context.
  * @param[in,out] input Input string to process, updated according to the processed/read data.
@@ -303,7 +305,7 @@
         for (offset = 0; in[offset] && is_xmlws(in[offset]); ++offset);
         LY_CHECK_ERR_RET(!in[offset], LOGVAL(ctx, LY_VLOG_LINE, &context->line, LY_VCODE_EOF), LY_EVALID);
         if (in[offset] == '<') {
-            in += offset;
+            (*input) = in + offset;
             return LY_EINVAL;
         }
     } else {
@@ -357,8 +359,8 @@
                     buf[len++] = '\"';
                     in += 6; /* &quot; */
                 } else {
-                    LOGVAL(ctx, LY_VLOG_LINE, &context->line, LY_VCODE_NSUPP,
-                           "entity references (except the predefined references)");
+                    LOGVAL(ctx, LY_VLOG_LINE, &context->line, LYVE_SYNTAX,
+                           "Entity reference \"%.*s\" not supported, only predefined references allowed.", 10, &in[offset-1]);
                     goto error;
                 }
                 offset = 0;
@@ -382,7 +384,7 @@
                         n = (16 * n) + u;
                     }
                 } else {
-                    LOGVAL(ctx, LY_VLOG_LINE, &context->line, LYVE_SYNTAX, "Invalid character reference %.*s", 12, p);
+                    LOGVAL(ctx, LY_VLOG_LINE, &context->line, LYVE_SYNTAX, "Invalid character reference \"%.*s\".", 12, p);
                     goto error;
 
                 }
diff --git a/tests/src/xml.c b/tests/src/xml.c
index f4fe2e7..d299116 100644
--- a/tests/src/xml.c
+++ b/tests/src/xml.c
@@ -290,19 +290,32 @@
     assert_true(str[0] == '\0'); /* everything eaten */
     assert_true(out[0] == '\0'); /* empty string */
 
+    /* empty element content - only formating before defining child */
+    str = "\n  <";
+    assert_int_equal(LY_EINVAL, lyxml_get_string(&ctx, &str, &out, &out_len));
+    assert_string_equal("<", str);
+
     /* empty element content is invalid - missing content terminating character < */
     str = "";
     assert_int_equal(LY_EVALID, lyxml_get_string(&ctx, &str, &out, &out_len));
     logbuf_assert("Unexpected end-of-file. Line number 1.");
+    str = p = "xxx";
+
+    free(out);
+    out = NULL;
+
+    assert_int_equal(LY_EVALID, lyxml_get_string(&ctx, &str, &out, &out_len));
+    logbuf_assert("Unexpected end-of-file. Line number 1.");
+    assert_ptr_equal(p, str); /* input data not eaten */
 
     free(out);
     out = NULL;
 
     /* valid strings */
-    str = "€𠜎Øn \n&lt;&amp;&quot;&apos;&gt; &#82;&#x52;<";
+    str = "€𠜎Øn \n&lt;&amp;&quot;&apos;&gt; &#82;&#x4f;&#x4B;<";
     assert_int_equal(LY_SUCCESS, lyxml_get_string(&ctx, &str, &out, &out_len));
-    assert_int_equal(21, out_len);
-    assert_string_equal("€𠜎Øn \n<&\"\'> RR", out);
+    assert_int_equal(22, out_len);
+    assert_string_equal("€𠜎Øn \n<&\"\'> ROK", out);
     assert_string_equal("<", str);
 
     /* invalid characters in string */
@@ -314,6 +327,14 @@
     assert_int_equal(LY_EVALID, lyxml_get_string(&ctx, &str, &out, &out_len));
     logbuf_assert("Invalid character sequence \"\"\", expected ;. Line number 2.");
     assert_ptr_equal(p, str); /* input data not eaten */
+    str = p = "\"&nonsence;\"";
+    assert_int_equal(LY_EVALID, lyxml_get_string(&ctx, &str, &out, &out_len));
+    logbuf_assert("Entity reference \"&nonsence;\" not supported, only predefined references allowed. Line number 2.");
+    assert_ptr_equal(p, str); /* input data not eaten */
+    str = p = "&#o122;";
+    assert_int_equal(LY_EVALID, lyxml_get_string(&ctx, &str, &out, &out_len));
+    logbuf_assert("Invalid character reference \"&#o122;\". Line number 2.");
+    assert_ptr_equal(p, str); /* input data not eaten */
 
     free(out);
 }