}
char *xml_string(char *s)
+{
+ return xml_string0 (s, FALSE);
+}
+
+/* xml_string0:
+ * Encode input string as an xml string.
+ * If raw is true, the input is interpreted as having no
+ * embedded escape sequences.
+ * Uses a static buffer, so non-re-entrant.
+ */
+char *xml_string0(char *s, boolean raw)
{
static char *buf = NULL;
static int bufsize = 0;
p = buf + pos;
}
/* escape '&' only if not part of a legal entity sequence */
- if (*s == '&' && !(xml_isentity(s))) {
+ if (*s == '&' && (raw || !(xml_isentity(s)))) {
sub = "&";
len = 5;
}
extern void attach_attrs(graph_t * g);
extern void attach_attrs_and_arrows(graph_t*, int*, int*);
extern char *xml_string(char *str);
+ extern char *xml_string0(char *str, boolean raw);
extern void write_plain(GVJ_t * job, graph_t * g, FILE * f, boolean extend);
extern double yDir (double y);
extern char *ps_string(char *s, int);
assert(0); /* internal error */
}
gvputs(job, ">");
- gvputs(job, xml_string(para->str));
+ gvputs(job, xml_string0(para->str, TRUE));
gvputs(job, "</text>\n");
}
if (flags & HTML_SUB)
agxbput(&xb,"<sub>");
- agxbput (&xb,xml_string(para->str));
+ agxbput (&xb,xml_string0(para->str, TRUE));
if (flags & HTML_SUB)
agxbput(&xb,"</sub>");