8 #include <libxml/parser.h>
9 #include <libxml/tree.h>
12 void add_xml_int(xmlNodePtr ptr
,xmlChar
*name
,int val
)
16 sprintf((char *)buf
,"%d",val
);
17 if (xmlSetProp(ptr
,name
,buf
) == 0)
18 gmx_fatal(FARGS
,"Setting %s",(char *)name
);
21 void add_xml_double(xmlNodePtr ptr
,xmlChar
*name
,double val
)
25 sprintf((char *)buf
,"%g",val
);
26 if (xmlSetProp(ptr
,name
,buf
) == 0)
27 gmx_fatal(FARGS
,"Setting %s",(char *)name
);
30 void add_xml_char(xmlNodePtr ptr
,xmlChar
*name
,char *val
)
32 if (xmlSetProp(ptr
,name
,(xmlChar
*)val
) == 0)
33 gmx_fatal(FARGS
,"Setting %s",(char *)name
);
36 xmlNodePtr
add_xml_child(xmlNodePtr parent
,char *type
)
40 if ((child
= xmlNewChild(parent
,NULL
,(xmlChar
*)type
,NULL
)) == NULL
)
41 gmx_fatal(FARGS
,"Creating element %s",(char *)type
);
46 xmlNodePtr
add_xml_comment(xmlDocPtr doc
,
47 xmlNodePtr prev
,xmlChar
*comment
)
51 if ((comm
= xmlNewComment(comment
)) == NULL
)
52 gmx_fatal(FARGS
,"Creating doc comment element");
54 while (ptr
->next
!= NULL
)