-
Notifications
You must be signed in to change notification settings - Fork 93
/
Copy pathmemberlist.c
64 lines (57 loc) · 1.58 KB
/
memberlist.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*****************************************************************
* This program is free software; you can redistribute it and/or
* modify it under the terms of the license contained in the
* COPYING file that comes with the expat distribution.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Must be used with Expat compiled for UTF-8 output.
*/
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <sstream>
#include <string>
#include <math.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#include "../expat_justparse_interface.h"
using namespace std;
void start(const char *el, const char **attr)
{
if (!strcmp(el, "member"))
{
unsigned int ref(0);
string type, role;
for (unsigned int i(0); attr[i]; i += 2)
{
if (!strcmp(attr[i], "ref"))
ref = atol(attr[i+1]);
else if (!strcmp(attr[i], "type"))
type = attr[i+1];
else if (!strcmp(attr[i], "role"))
role = attr[i+1];
}
if (type == "relation")
{
cout<<ref<<'\n';
}
}
}
void end(const char *el)
{
}
int main(int argc, char *argv[])
{
//reading the main document
parse(stdin, start, end);
return 0;
}