0% found this document useful (0 votes)
1K views

Installing Mini XML With Sample Program

Mini-XML is a small XML library that you can use to read and write XML and XML-like data files in your application without requiring large non-standard libraries. Mini-XML only requires an ANSI C compatible compiler (GCC works, as do most vendors' ANSI C compilers) and a 'make' program.

Uploaded by

hypernuclide
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views

Installing Mini XML With Sample Program

Mini-XML is a small XML library that you can use to read and write XML and XML-like data files in your application without requiring large non-standard libraries. Mini-XML only requires an ANSI C compatible compiler (GCC works, as do most vendors' ANSI C compilers) and a 'make' program.

Uploaded by

hypernuclide
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Adding sources :

Open the terminal and type in

$ sudo gedit /etc/apt/sources.list

and copy this and paste it in the sopurce.list

deb http://ppa.launchpad.net/persia/ppa/ubuntu jaunty main

deb-src http://ppa.launchpad.net/persia/ppa/ubuntu jaunty main

save avd close the source.list

Adding Key & Updating:

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys


4A529FBA

$ sudo apt-get updates

$ apt-cache search mxml

libmxml-dev - small XML parsing library (development)

libmxml1 - small XML parsing library (runtime)

trmxml - MusicBrainz TRM Generator

$ sudo apt-get install PACKAGE NAME

PACKAGE NAME libmxml-dev

! "

!
Example Program:
#include <mxml.h>

#include <fcntl.h>

int main()

FILE *fp;

mxml_node_t *xml; /* <?xml ... ?> */

mxml_node_t *data; /* <data> */

mxml_node_t *node; /* <node> */

mxml_node_t *group; /* <group> */

xml = mxmlNewXML("1.0");

data = mxmlNewElement(xml, "data");

node = mxmlNewElement(data, "node");

mxmlNewText(node, 0, "val1");

node = mxmlNewElement(data, "node");

mxmlNewText(node, 0, "val2");

node = mxmlNewElement(data, "node");

mxmlNewText(node, 0, "val3");

group = mxmlNewElement(data, "group");

node = mxmlNewElement(group, "node");

mxmlNewText(node, 0, "val4");

node = mxmlNewElement(group, "node");


mxmlNewText(node, 0, "val5");

node = mxmlNewElement(group, "node");

mxmlNewText(node, 0, "val6");

node = mxmlNewElement(data, "node");

mxmlNewText(node, 0, "val7");

node = mxmlNewElement(data, "node");

mxmlNewText(node, 0, "val8");

fp = fopen("filename.xml", "w");

mxmlSaveFile(xml, fp, MXML_NO_CALLBACK);

fclose(fp);

return(0);

Compiling :
$ gcc -o myprog myprog.c -lmxml

$ gcc -o myprog myprog.c -lmxml -pthread

! ! ! $ %&'( %&)&

You might also like