1 /* xmlmisc.h
2  *
3  * ===========================================================================
4  *
5  *                            PUBLIC DOMAIN NOTICE
6  *               National Center for Biotechnology Information
7  *
8  *  This software/database is a "United States Government Work" under the
9  *  terms of the United States Copyright Act.  It was written as part of
10  *  the author's official duties as a United States Government employee and
11  *  thus cannot be copyrighted.  This software/database is freely available
12  *  to the public for use. The National Library of Medicine and the U.S.
13  *  Government have not placed any restriction on its use or reproduction.
14  *
15  *  Although all reasonable efforts have been taken to ensure the accuracy
16  *  and reliability of the software and data, the NLM and the U.S.
17  *  Government do not and cannot warrant the performance or results that
18  *  may be obtained by using this software or data. The NLM and the U.S.
19  *  Government disclaim all warranties, express or implied, including
20  *  warranties of performance, merchantability or fitness for any particular
21  *  purpose.
22  *
23  *  Please cite the author in any work or product based on this material.
24  *
25  * ===========================================================================
26  *
27  * File Name:  xmlmisc.h
28  *
29  * Author: Alexey Dobronadezhdin
30  *
31  * File Description:
32  * -----------------
33  *      XML functionality from C-toolkit.
34  */
35 
36 #ifndef XMLMISC_H
37 #define XMLMISC_H
38 
39 #include "valnode.h"
40 /* Simple XML Parsing */
41 
42 BEGIN_NCBI_SCOPE
43 
44 typedef struct xmlobj {
45     char*    name;
46     char*    contents;
47     short       level;
48     struct xmlobj  *attributes;
49     struct xmlobj  *children;
50     struct xmlobj  *next;
51     struct xmlobj  *parent;
52     struct xmlobj  *successor;        /* linearizes a recursive exploration */
53 } Nlm_XmlObj, *Nlm_XmlObjPtr;
54 
55 #define XmlObj Nlm_XmlObj
56 #define XmlObjPtr Nlm_XmlObjPtr
57 
58 typedef void(*VisitXmlNodeFunc) (Nlm_XmlObjPtr xop, Nlm_XmlObjPtr parent, short level, void* userdata);
59 
60 Nlm_XmlObjPtr ParseXmlString(const Char* str);
61 Nlm_XmlObjPtr FreeXmlObject(Nlm_XmlObjPtr xop);
62 int VisitXmlNodes(Nlm_XmlObjPtr xop, void* userdata, VisitXmlNodeFunc callback, char* nodeFilter,
63                        char* parentFilter, char* attrTagFilter, char* attrValFilter, short maxDepth);
64 
65 END_NCBI_SCOPE
66 
67 #endif
68