1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- /*****************************************************************
- * 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;
- }
|