state->schema_root = gvdb_hash_table_insert (state->schema, "");
if (path != NULL)
- gvdb_hash_table_insert_string (state->schema,
- ".path", path);
+ {
+ if (!g_str_has_prefix (path, "/") ||
+ !g_str_has_suffix (path, "/"))
+ {
+ g_set_error (error, G_MARKUP_ERROR,
+ G_MARKUP_ERROR_INVALID_CONTENT,
+ "a path, if given, must begin and "
+ "end with a slash");
+ return;
+ }
+
+ gvdb_hash_table_insert_string (state->schema,
+ ".path", path);
+ }
}
else
g_set_error (error, G_MARKUP_ERROR,
{ "default-not-in-choices", NULL, "*<default> contains string not in <choices>*" },
{ "array-default-not-in-choices", NULL, "*<default> contains string not in <choices>*" },
{ "bad-key", NULL, "*invalid name*" },
+ { "invalid-path", NULL, "*must begin and end with a slash*" },
{ "bad-key", "--allow-any-name", NULL },
{ "bad-key2", NULL, "*invalid name*" },
{ "bad-key2", "--allow-any-name", NULL },