SpatiaLite  4.1.0
 All Data Structures Files Functions Variables Typedefs Macros Pages
gg_xml.h
Go to the documentation of this file.
1 /*
2  gg_xml.h -- Gaia common support for XML documents
3 
4  version 4.1, 2013 May 8
5 
6  Author: Sandro Furieri a.furieri@lqt.it
7 
8  ------------------------------------------------------------------------------
9 
10  Version: MPL 1.1/GPL 2.0/LGPL 2.1
11 
12  The contents of this file are subject to the Mozilla Public License Version
13  1.1 (the "License"); you may not use this file except in compliance with
14  the License. You may obtain a copy of the License at
15  http://www.mozilla.org/MPL/
16 
17 Software distributed under the License is distributed on an "AS IS" basis,
18 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
19 for the specific language governing rights and limitations under the
20 License.
21 
22 The Original Code is the SpatiaLite library
23 
24 The Initial Developer of the Original Code is Alessandro Furieri
25 
26 Portions created by the Initial Developer are Copyright (C) 2008-2013
27 the Initial Developer. All Rights Reserved.
28 
29 Contributor(s):
30 
31 Alternatively, the contents of this file may be used under the terms of
32 either the GNU General Public License Version 2 or later (the "GPL"), or
33 the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
34 in which case the provisions of the GPL or the LGPL are applicable instead
35 of those above. If you wish to allow use of your version of this file only
36 under the terms of either the GPL or the LGPL, and not to allow others to
37 use your version of this file under the terms of the MPL, indicate your
38 decision by deleting the provisions above and replace them with the notice
39 and other provisions required by the GPL or the LGPL. If you do not delete
40 the provisions above, a recipient may use your version of this file under
41 the terms of any one of the MPL, the GPL or the LGPL.
42 
43 */
44 
45 
52 #ifndef _GG_XML_H
53 #ifndef DOXYGEN_SHOULD_SKIP_THIS
54 #define _GG_XML_H
55 #endif
56 
57 #ifdef __cplusplus
58 extern "C"
59 {
60 #endif
61 
62 /* constant values for XmlBLOB */
63 
65 #define GAIA_XML_START 0x00
66 
67 #define GAIA_XML_END 0xDD
68 
69 #define GAIA_XML_HEADER 0xAB
70 
71 #define GAIA_XML_SCHEMA 0xBA
72 
73 #define GAIA_XML_FILEID 0xCA
74 
75 #define GAIA_XML_PARENTID 0xDA
76 
77 #define GAIA_XML_TITLE 0xDB
78 
79 #define GAIA_XML_ABSTRACT 0xDC
80 
81 #define GAIA_XML_GEOMETRY 0xDD
82 
83 #define GAIA_XML_CRC32 0xBC
84 
85 #define GAIA_XML_PAYLOAD 0xCB
86 
87 /* bitmasks for XmlBLOB-FLAG */
88 
90 #define GAIA_XML_LITTLE_ENDIAN 0x01
91 
92 #define GAIA_XML_COMPRESSED 0x02
93 
94 #define GAIA_XML_VALIDATED 0x04
95 
96 #define GAIA_XML_ISO_METADATA 0x80
97 
98 #define GAIA_XML_SLD_SE_RASTER_STYLE 0x10
99 
100 #define GAIA_XML_SLD_SE_VECTOR_STYLE 0x40
101 
102 #define GAIA_XML_SVG 0x20
103 
104 
105 /* function prototypes */
106 
107 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
108 #ifdef ENABLE_LIBXML2 /* LIBXML2 enabled: supporting XML documents */
109 #endif
110 
120  GAIAGEO_DECLARE char *gaia_libxml2_version (void);
121 
146  GAIAGEO_DECLARE void gaiaXmlToBlob (void *p_cache, const unsigned char *xml,
147  int xml_len, int compressed,
148  const char *schemaURI,
149  unsigned char **result, int *size,
150  char **parsing_errors,
151  char **schema_validation_errors);
152 
174  GAIAGEO_DECLARE char *gaiaXmlTextFromBlob (const unsigned char *blob,
175  int size, int indent);
176 
199  GAIAGEO_DECLARE void gaiaXmlFromBlob (const unsigned char *blob,
200  int size, int indent,
201  unsigned char **result,
202  int *res_size);
203 
216  GAIAGEO_DECLARE int gaiaIsValidXmlBlob (const unsigned char *blob,
217  int size);
218 
231  GAIAGEO_DECLARE int gaiaIsCompressedXmlBlob (const unsigned char *blob,
232  int size);
233 
246  GAIAGEO_DECLARE int gaiaIsIsoMetadataXmlBlob (const unsigned char *blob,
247  int size);
248 
261  GAIAGEO_DECLARE int gaiaIsSldSeVectorStyleXmlBlob (const unsigned char
262  *blob, int size);
263 
276  GAIAGEO_DECLARE int gaiaIsSldSeRasterStyleXmlBlob (const unsigned char
277  *blob, int size);
278 
291  GAIAGEO_DECLARE int gaiaIsSvgXmlBlob (const unsigned char *blob, int size);
292 
309  GAIAGEO_DECLARE void gaiaXmlBlobCompression (const unsigned char *blob,
310  int in_size, int compressed,
311  unsigned char **result,
312  int *out_size);
313 
327  GAIAGEO_DECLARE int gaiaIsSchemaValidatedXmlBlob (const unsigned char *blob,
328  int size);
329 
339  GAIAGEO_DECLARE int gaiaXmlBlobGetDocumentSize (const unsigned char *blob,
340  int size);
341 
356  GAIAGEO_DECLARE char *gaiaXmlBlobGetSchemaURI (const unsigned char
357  *blob, int size);
358 
374  GAIAGEO_DECLARE char *gaiaXmlGetInternalSchemaURI (void *p_cache,
375  const unsigned char *xml,
376  int xml_len);
377 
392  GAIAGEO_DECLARE char *gaiaXmlBlobGetFileId (const unsigned char
393  *blob, int size);
394 
409  GAIAGEO_DECLARE char *gaiaXmlBlobGetParentId (const unsigned char
410  *blob, int size);
411 
429  GAIAGEO_DECLARE int gaiaXmlBlobSetFileId (void *p_cache, const unsigned char
430  *blob, int size,
431  const char *identifier,
432  unsigned char **new_blob,
433  int *new_size);
434 
452  GAIAGEO_DECLARE int gaiaXmlBlobSetParentId (void *p_cache,
453  const unsigned char *blob,
454  int size,
455  const char *identifier,
456  unsigned char **new_blob,
457  int *new_size);
458 
480  GAIAGEO_DECLARE int gaiaXmlBlobAddFileId (void *p_cache, const unsigned char
481  *blob, int size,
482  const char *identifier,
483  const char *ns_id,
484  const char *uri_id,
485  const char *ns_charstr,
486  const char *uri_charstr,
487  unsigned char **new_blob,
488  int *new_size);
489 
511  GAIAGEO_DECLARE int gaiaXmlBlobAddParentId (void *p_cache,
512  const unsigned char *blob,
513  int size,
514  const char *identifier,
515  const char *ns_id,
516  const char *uri_id,
517  const char *ns_charstr,
518  const char *uri_charstr,
519  unsigned char **new_blob,
520  int *new_size);
521 
537  GAIAGEO_DECLARE char *gaiaXmlBlobGetTitle (const unsigned char
538  *blob, int size);
539 
555  GAIAGEO_DECLARE char *gaiaXmlBlobGetAbstract (const unsigned char
556  *blob, int size);
557 
574  GAIAGEO_DECLARE void gaiaXmlBlobGetGeometry (const unsigned char
575  *blob, int size,
576  unsigned char **blob_geom,
577  int *blob_size);
578 
591  GAIAGEO_DECLARE char *gaiaXmlBlobGetEncoding (const unsigned char
592  *blob, int size);
593 
608  GAIAGEO_DECLARE char *gaiaXmlBlobGetLastParseError (void *p_cache);
609 
624  GAIAGEO_DECLARE char *gaiaXmlBlobGetLastValidateError (void *p_cache);
625 
637  GAIAGEO_DECLARE int gaiaIsValidXPathExpression (void *p_cache,
638  const char *xpath_expr);
639 
654  GAIAGEO_DECLARE char *gaiaXmlBlobGetLastXPathError (void *p_cache);
655 
672  GAIAGEO_DECLARE int gaiaXmlLoad (void *p_cache, const char *path_or_url,
673  unsigned char **result, int *size,
674  char **parsing_errors);
675 
701  GAIAGEO_DECLARE int gaiaXmlStore (const unsigned char *blob, int size,
702  const char *path, int indent);
703 
704 #endif /* end LIBXML2: supporting XML documents */
705 
706 #ifdef __cplusplus
707 }
708 #endif
709 
710 #endif /* _GG_XML_H */