1 /* libxml2 - Library for parsing XML documents
2  * Copyright (C) 2006-2019 Free Software Foundation, Inc.
3  *
4  * This file is not part of the GNU gettext program, but is used with
5  * GNU gettext.
6  *
7  * The original copyright notice is as follows:
8  */
9 
10 /*
11  * Copyright (C) 1998-2012 Daniel Veillard.  All Rights Reserved.
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining a copy
14  * of this software and associated documentation files (the "Software"), to deal
15  * in the Software without restriction, including without limitation the rights
16  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17  * copies of the Software, and to permit persons to whom the Software is fur-
18  * nished to do so, subject to the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be included in
21  * all copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
25  * NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
26  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29  * THE SOFTWARE.
30  *
31  * Author: Daniel Veillard
32  */
33 
34 /*
35  * Summary: implementation of XML Schema Datatypes
36  * Description: module providing the XML Schema Datatypes implementation
37  *              both definition and validity checking
38  */
39 
40 #ifndef __XML_SCHEMA_TYPES_H__
41 #define __XML_SCHEMA_TYPES_H__
42 
43 #include <libxml/xmlversion.h>
44 
45 #ifdef LIBXML_SCHEMAS_ENABLED
46 
47 #include <libxml/schemasInternals.h>
48 #include <libxml/xmlschemas.h>
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
54 typedef enum {
55     XML_SCHEMA_WHITESPACE_UNKNOWN = 0,
56     XML_SCHEMA_WHITESPACE_PRESERVE = 1,
57     XML_SCHEMA_WHITESPACE_REPLACE = 2,
58     XML_SCHEMA_WHITESPACE_COLLAPSE = 3
59 } xmlSchemaWhitespaceValueType;
60 
61 XMLPUBFUN void XMLCALL
62 		xmlSchemaInitTypes		(void);
63 XMLPUBFUN void XMLCALL
64 		xmlSchemaCleanupTypes		(void);
65 XMLPUBFUN xmlSchemaTypePtr XMLCALL
66 		xmlSchemaGetPredefinedType	(const xmlChar *name,
67 						 const xmlChar *ns);
68 XMLPUBFUN int XMLCALL
69 		xmlSchemaValidatePredefinedType	(xmlSchemaTypePtr type,
70 						 const xmlChar *value,
71 						 xmlSchemaValPtr *val);
72 XMLPUBFUN int XMLCALL
73 		xmlSchemaValPredefTypeNode	(xmlSchemaTypePtr type,
74 						 const xmlChar *value,
75 						 xmlSchemaValPtr *val,
76 						 xmlNodePtr node);
77 XMLPUBFUN int XMLCALL
78 		xmlSchemaValidateFacet		(xmlSchemaTypePtr base,
79 						 xmlSchemaFacetPtr facet,
80 						 const xmlChar *value,
81 						 xmlSchemaValPtr val);
82 XMLPUBFUN int XMLCALL
83 		xmlSchemaValidateFacetWhtsp	(xmlSchemaFacetPtr facet,
84 						 xmlSchemaWhitespaceValueType fws,
85 						 xmlSchemaValType valType,
86 						 const xmlChar *value,
87 						 xmlSchemaValPtr val,
88 						 xmlSchemaWhitespaceValueType ws);
89 XMLPUBFUN void XMLCALL
90 		xmlSchemaFreeValue		(xmlSchemaValPtr val);
91 XMLPUBFUN xmlSchemaFacetPtr XMLCALL
92 		xmlSchemaNewFacet		(void);
93 XMLPUBFUN int XMLCALL
94 		xmlSchemaCheckFacet		(xmlSchemaFacetPtr facet,
95 						 xmlSchemaTypePtr typeDecl,
96 						 xmlSchemaParserCtxtPtr ctxt,
97 						 const xmlChar *name);
98 XMLPUBFUN void XMLCALL
99 		xmlSchemaFreeFacet		(xmlSchemaFacetPtr facet);
100 XMLPUBFUN int XMLCALL
101 		xmlSchemaCompareValues		(xmlSchemaValPtr x,
102 						 xmlSchemaValPtr y);
103 XMLPUBFUN xmlSchemaTypePtr XMLCALL
104     xmlSchemaGetBuiltInListSimpleTypeItemType	(xmlSchemaTypePtr type);
105 XMLPUBFUN int XMLCALL
106     xmlSchemaValidateListSimpleTypeFacet	(xmlSchemaFacetPtr facet,
107 						 const xmlChar *value,
108 						 unsigned long actualLen,
109 						 unsigned long *expectedLen);
110 XMLPUBFUN xmlSchemaTypePtr XMLCALL
111 		xmlSchemaGetBuiltInType		(xmlSchemaValType type);
112 XMLPUBFUN int XMLCALL
113 		xmlSchemaIsBuiltInTypeFacet	(xmlSchemaTypePtr type,
114 						 int facetType);
115 XMLPUBFUN xmlChar * XMLCALL
116 		xmlSchemaCollapseString		(const xmlChar *value);
117 XMLPUBFUN xmlChar * XMLCALL
118 		xmlSchemaWhiteSpaceReplace	(const xmlChar *value);
119 XMLPUBFUN unsigned long  XMLCALL
120 		xmlSchemaGetFacetValueAsULong	(xmlSchemaFacetPtr facet);
121 XMLPUBFUN int XMLCALL
122 		xmlSchemaValidateLengthFacet	(xmlSchemaTypePtr type,
123 						 xmlSchemaFacetPtr facet,
124 						 const xmlChar *value,
125 						 xmlSchemaValPtr val,
126 						 unsigned long *length);
127 XMLPUBFUN int XMLCALL
128 		xmlSchemaValidateLengthFacetWhtsp(xmlSchemaFacetPtr facet,
129 						  xmlSchemaValType valType,
130 						  const xmlChar *value,
131 						  xmlSchemaValPtr val,
132 						  unsigned long *length,
133 						  xmlSchemaWhitespaceValueType ws);
134 XMLPUBFUN int XMLCALL
135 		xmlSchemaValPredefTypeNodeNoNorm(xmlSchemaTypePtr type,
136 						 const xmlChar *value,
137 						 xmlSchemaValPtr *val,
138 						 xmlNodePtr node);
139 XMLPUBFUN int XMLCALL
140 		xmlSchemaGetCanonValue		(xmlSchemaValPtr val,
141 						 const xmlChar **retValue);
142 XMLPUBFUN int XMLCALL
143 		xmlSchemaGetCanonValueWhtsp	(xmlSchemaValPtr val,
144 						 const xmlChar **retValue,
145 						 xmlSchemaWhitespaceValueType ws);
146 XMLPUBFUN int XMLCALL
147 		xmlSchemaValueAppend		(xmlSchemaValPtr prev,
148 						 xmlSchemaValPtr cur);
149 XMLPUBFUN xmlSchemaValPtr XMLCALL
150 		xmlSchemaValueGetNext		(xmlSchemaValPtr cur);
151 XMLPUBFUN const xmlChar * XMLCALL
152 		xmlSchemaValueGetAsString	(xmlSchemaValPtr val);
153 XMLPUBFUN int XMLCALL
154 		xmlSchemaValueGetAsBoolean	(xmlSchemaValPtr val);
155 XMLPUBFUN xmlSchemaValPtr XMLCALL
156 		xmlSchemaNewStringValue		(xmlSchemaValType type,
157 						 const xmlChar *value);
158 XMLPUBFUN xmlSchemaValPtr XMLCALL
159 		xmlSchemaNewNOTATIONValue	(const xmlChar *name,
160 						 const xmlChar *ns);
161 XMLPUBFUN xmlSchemaValPtr XMLCALL
162 		xmlSchemaNewQNameValue		(const xmlChar *namespaceName,
163 						 const xmlChar *localName);
164 XMLPUBFUN int XMLCALL
165 		xmlSchemaCompareValuesWhtsp	(xmlSchemaValPtr x,
166 						 xmlSchemaWhitespaceValueType xws,
167 						 xmlSchemaValPtr y,
168 						 xmlSchemaWhitespaceValueType yws);
169 XMLPUBFUN xmlSchemaValPtr XMLCALL
170 		xmlSchemaCopyValue		(xmlSchemaValPtr val);
171 XMLPUBFUN xmlSchemaValType XMLCALL
172 		xmlSchemaGetValType		(xmlSchemaValPtr val);
173 
174 #ifdef __cplusplus
175 }
176 #endif
177 
178 #endif /* LIBXML_SCHEMAS_ENABLED */
179 #endif /* __XML_SCHEMA_TYPES_H__ */
180