xmlpull.man (2151B)
1 .TH XMLPULL 2 2 .SH NAME 3 open_xmlpull, 4 next_xmlpull, 5 free_xmlpull \- XML-Pull parser functions 6 .SH SYNOPSIS 7 .PP 8 .EX 9 .ta 4n +4n +4n +4n 10 #include <u.h> 11 #include <xmlpull.h> 12 .sp 13 enum { 14 START_DOCUMENT = 0x0, 15 START_TAG, 16 START_END_TAG, 17 TEXT, 18 TEXT_C, 19 ATTR, 20 END_TAG, 21 END_TAG_S, 22 END_TAG_N, 23 END_DOCUMENT, 24 }; 25 .sp 26 .ta \w' 'u +\w'xmlpull 'u 27 typedef struct xmlpull xmlpull; 28 struct xmlpull { 29 int fd; 30 char ev; 31 char nev; 32 char *lm; 33 char *na; 34 char *va; 35 int la; 36 int lv; 37 int ln; 38 }; 39 .fi 40 .de XX 41 .ift .sp 0.5 42 .ifn .sp 43 .. 44 .PP 45 .nf 46 .ft L 47 .ta \w'\fLxmlpull* 'u +4n +4n +4n +4n 48 void freexmlpull(xmlpull *x); 49 xmlpull *openxmlpull(int fd); 50 xmlpull *nextxmlpull(xmlpull *x); 51 xmlpull *writexmlpull(xmlpull *x); 52 .EE 53 .SH DESCRIPTION 54 .PP 55 Libxmlpull is a library for parsing and writing XML-files. The parsing is 56 done in the way described on http://www.xmlpull.org, in a more simple way. 57 On the other side the writing does do XML-pull in the oder direction. 58 .PP 59 A parsing session is started by calling 60 .IR openxmlpull 61 , with a filedescriptor from which is read until it is manually closed. 62 It returns the structure xmlpull, holding the state of the actual 63 session. 64 .PP 65 Next the function 66 .IR nextxmlpull 67 is constantly called and gives back the 68 next event found in the read data. 69 .IR nextxmlpull 70 returns the changed xmlpull structure with the actual 71 read event. 72 .PP 73 The actual event is saved in xmlpull->ev, the name of the element or 74 attribute in xmlpull->na and its length in xmlpull->ln. When the event 75 has the value ATTR, xmlpull->va holds the data of the value of the 76 attribute and xmlpull->lv its length. The events START_DOCUMENT and 77 END_DOCUMENT do not have any values. END_TAG_S and END_TAG_N are only 78 used by 79 .IR write_elem . 80 .PP 81 Writing is done by opening a session with 82 .IR openxmlpull 83 and then doing a 84 .IR writexmlpull 85 in the other direction like 86 .IR nextxmlpull . 87 .PP 88 When the session is finished, all allocated memory can be freed by calling 89 .IR freexmlpull . 90 .PP 91 .SH FILES 92 .PP 93 .B test_read.c (mkfile.read) 94 example for reading an XML-file.. 95 .B test_write.c (mkfile.write) 96 example for writing an XML-file. 97 .SH SOURCE 98 .B http://www.r-36.net/xmlpull.tgz