3 @@ -599,6 +599,19 @@ ezxml_t ezxml_parse_str(char *s, size_t
4 else return ezxml_err(root, d, "unclosed tag <%s>", root->cur->name);
7 +// parse the given xml string and return an ezxml structure
8 +ezxml_t ezxml_parse_str_d(char const *_s, size_t len)
13 + if (! (s = strndup(_s, len))) return NULL;
15 + root = (ezxml_root_t)ezxml_parse_str(s, strlen(s));
16 + root->len = -1; // so we know to free s in ezxml_free()
20 // Wrapper for ezxml_parse_str() that accepts a file stream. Reads the entire
21 // stream into memory and then parses it. For xml files, use ezxml_parse_file()
22 // or ezxml_parse_fd()
25 @@ -59,6 +59,11 @@ struct ezxml {
26 // pass in the copy. Returns NULL on failure.
27 ezxml_t ezxml_parse_str(char *s, size_t len);
29 +// Given a string of xml data and its length, parses it and creates an ezxml
30 +// structure. that strdup()s s
31 +// Returns NULL on failure.
32 +ezxml_t ezxml_parse_str_d(char const *s, size_t len);
34 // A wrapper for ezxml_parse_str() that accepts a file descriptor. First
35 // attempts to mem map the file. Failing that, reads the file into memory.
36 // Returns NULL on failure.