source: trunk/include/helpers/xml.h@ 29

Last change on this file since 29 was 10, checked in by umoeller, 25 years ago

Added simple XML parsing.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 KB
Line 
1
2/*
3 *@@sourcefile xml.h:
4 * header file for xml.c (XML parsing).
5 *
6 * See remarks there.
7 *
8 *@@added V0.9.6 (2000-10-29) [umoeller]
9 *@@include #include <os2.h>
10 *@@include #include "linklist.h"
11 *@@include #include "xml.h"
12 */
13
14#if __cplusplus
15extern "C" {
16#endif
17
18#ifndef XML_HEADER_INCLUDED
19 #define XML_HEADER_INCLUDED
20
21 // define some basic things to make this work even with standard C
22 #if (!defined OS2_INCLUDED) && (!defined _OS2_H) && (!defined __SIMPLES_DEFINED) // changed V0.9.0 (99-10-22) [umoeller]
23 typedef unsigned long BOOL;
24 typedef unsigned long ULONG;
25 typedef unsigned char *PSZ;
26 #define TRUE (BOOL)1
27 #define FALSE (BOOL)0
28
29 #ifdef __IBMCPP__ // added V0.9.0 (99-10-22) [umoeller]
30 #define APIENTRY _System
31 #endif
32
33 #define __SIMPLES_DEFINED
34 #endif
35
36 #define DOMERR_INDEX_SIZE 1;
37 #define DOMERR_DOMSTRING_SIZE 2;
38 #define DOMERR_HIERARCHY_REQUEST 3;
39 #define DOMERR_WRONG_DOCUMENT 4;
40 #define DOMERR_INVALID_CHARACTER 5;
41 #define DOMERR_NO_DATA_ALLOWED 6;
42 #define DOMERR_NO_MODIFICATION_ALLOWED 7;
43 #define DOMERR_NOT_FOUND 8;
44 #define DOMERR_NOT_SUPPORTED 9;
45 #define DOMERR_INUSE_ATTRIBUTE 10;
46
47 #define DOMNODE_ELEMENT 1 // node is an ELEMENT
48 #define DOMNODE_ATTRIBUTE 2 // node is an ATTRIBUTE
49 #define DOMNODE_TEXT 3 // node is a TEXT node
50 // #define DOMNODE_CDATA_SECTION 4
51 // #define DOMNODE_ENTITY_REFERENCE 5
52 // #define DOMNODE_ENTITY 6
53 // #define DOMNODE_PROCESSING_INSTRUCTION 7
54 #define DOMNODE_COMMENT 8 // node is a COMMENT
55 #define DOMNODE_DOCUMENT 9 // node is a document
56 #define DOMNODE_DOCUMENT_TYPE 10 // node is a DOCUMENTTYPE
57 // #define DOMNODE_DOCUMENT_FRAGMENT 11
58 // #define DOMNODE_NOTATION 12
59
60 /*
61 *@@ DOMNODE:
62 * this represents one node in an XML document.
63 *
64 * Per definition, each XML document is broken down into
65 * DOM nodes. The document itself is represented by a
66 * node with the DOMNODE_DOCUMENT type, which in turn
67 * contains all the other nodes. This thus forms a tree
68 * as shown with xmlParse.
69 *
70 * The contents of the members vary according
71 * to ulNodeType:
72 *
73 + ulNodeType pszNodeName pszNodeValue listAttributeNodes
74 +
75 + ELEMENT tag name 0 named node map
76 +
77 + ATTRIBUTE attribute name attribute value 0
78 +
79 + TEXT 0 text contents 0
80 +
81 + COMMENT 0 comment contents 0
82 +
83 + DOCUMENT 0 0 0
84 */
85
86 typedef struct _DOMNODE
87 {
88 ULONG ulNodeType;
89
90 PSZ pszNodeName;
91 PSZ pszNodeValue;
92
93 struct _DOMNODE *pParentNode;
94 // the parent node;
95 // NULL for DOCUMENT, DOCUMENT_FRAGMENT and ATTR
96 LINKLIST listChildNodes; // of DOMNODE* pointers
97
98 LINKLIST listAttributeNodes; // of DOMNODE* pointers
99
100 } DOMNODE, *PDOMNODE;
101
102 #define XMLACTION_BREAKUP 1
103 #define XMLACTION_COPYASTEXT 2
104
105 typedef ULONG _Optlink FNVALIDATE(const char *pcszTag);
106 typedef FNVALIDATE *PFNVALIDATE;
107
108 PDOMNODE xmlCreateNode(PDOMNODE pParentNode,
109 ULONG ulNodeType);
110
111 ULONG xmlDeleteNode(PDOMNODE pNode);
112
113 ULONG xmlParse(PDOMNODE pParentNode,
114 const char *pcszBuf,
115 PFNVALIDATE pfnValidateTag);
116
117 PDOMNODE xmlCreateDocumentFromString(const char *pcszXML,
118 PFNVALIDATE pfnValidateTag);
119
120#endif
121
122#if __cplusplus
123}
124#endif
125
Note: See TracBrowser for help on using the repository browser.