SpatiaLite  4.2.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.2, 2014 July 25
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 0xAC
70 
71 #define GAIA_XML_LEGACY_HEADER 0xAB
72 
73 #define GAIA_XML_SCHEMA 0xBA
74 
75 #define GAIA_XML_FILEID 0xCA
76 
77 #define GAIA_XML_PARENTID 0xDA
78 
79 #define GAIA_XML_NAME 0xDE
80 
81 #define GAIA_XML_TITLE 0xDB
82 
83 #define GAIA_XML_ABSTRACT 0xDC
84 
85 #define GAIA_XML_GEOMETRY 0xDD
86 
87 #define GAIA_XML_CRC32 0xBC
88 
89 #define GAIA_XML_PAYLOAD 0xCB
90 
91 /* bitmasks for XmlBLOB-FLAG */
92 
94 #define GAIA_XML_LITTLE_ENDIAN 0x01
95 
96 #define GAIA_XML_COMPRESSED 0x02
97 
98 #define GAIA_XML_VALIDATED 0x04
99 
100 #define GAIA_XML_ISO_METADATA 0x80
101 
102 #define GAIA_XML_SLD_SE_RASTER_STYLE 0x10
103 
104 #define GAIA_XML_SLD_SE_VECTOR_STYLE 0x40
105 
106 #define GAIA_XML_SLD_STYLE 0x48
107 
108 #define GAIA_XML_SVG 0x20
109 
110 
111 /* function prototypes */
112 
113 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
114 #ifdef ENABLE_LIBXML2 /* LIBXML2 enabled: supporting XML documents */
115 #endif
116 
126  GAIAGEO_DECLARE char *gaia_libxml2_version (void);
127 
152  GAIAGEO_DECLARE void gaiaXmlToBlob (const void *p_cache,
153  const unsigned char *xml, int xml_len,
154  int compressed, const char *schemaURI,
155  unsigned char **result, int *size,
156  char **parsing_errors,
157  char **schema_validation_errors);
158 
180  GAIAGEO_DECLARE char *gaiaXmlTextFromBlob (const unsigned char *blob,
181  int size, int indent);
182 
205  GAIAGEO_DECLARE void gaiaXmlFromBlob (const unsigned char *blob,
206  int size, int indent,
207  unsigned char **result,
208  int *res_size);
209 
223  GAIAGEO_DECLARE int gaiaIsValidXmlBlob (const unsigned char *blob,
224  int size);
225 
239  GAIAGEO_DECLARE int gaiaIsCompressedXmlBlob (const unsigned char *blob,
240  int size);
241 
255  GAIAGEO_DECLARE int gaiaIsIsoMetadataXmlBlob (const unsigned char *blob,
256  int size);
257 
271  GAIAGEO_DECLARE int gaiaIsSldSeVectorStyleXmlBlob (const unsigned char
272  *blob, int size);
273 
288  GAIAGEO_DECLARE int gaiaIsSldSeRasterStyleXmlBlob (const unsigned char
289  *blob, int size);
290 
305  GAIAGEO_DECLARE int gaiaIsSldStyleXmlBlob (const unsigned char
306  *blob, int size);
307 
321  GAIAGEO_DECLARE int gaiaIsSvgXmlBlob (const unsigned char *blob, int size);
322 
339  GAIAGEO_DECLARE void gaiaXmlBlobCompression (const unsigned char *blob,
340  int in_size, int compressed,
341  unsigned char **result,
342  int *out_size);
343 
358  GAIAGEO_DECLARE int gaiaIsSchemaValidatedXmlBlob (const unsigned char *blob,
359  int size);
360 
370  GAIAGEO_DECLARE int gaiaXmlBlobGetDocumentSize (const unsigned char *blob,
371  int size);
372 
387  GAIAGEO_DECLARE char *gaiaXmlBlobGetSchemaURI (const unsigned char
388  *blob, int size);
389 
405  GAIAGEO_DECLARE char *gaiaXmlGetInternalSchemaURI (const void *p_cache,
406  const unsigned char *xml,
407  int xml_len);
408 
423  GAIAGEO_DECLARE char *gaiaXmlBlobGetFileId (const unsigned char
424  *blob, int size);
425 
440  GAIAGEO_DECLARE char *gaiaXmlBlobGetParentId (const unsigned char
441  *blob, int size);
442 
460  GAIAGEO_DECLARE int gaiaXmlBlobSetFileId (const void *p_cache,
461  const unsigned char *blob,
462  int size, const char *identifier,
463  unsigned char **new_blob,
464  int *new_size);
465 
483  GAIAGEO_DECLARE int gaiaXmlBlobSetParentId (const void *p_cache,
484  const unsigned char *blob,
485  int size,
486  const char *identifier,
487  unsigned char **new_blob,
488  int *new_size);
489 
511  GAIAGEO_DECLARE int gaiaXmlBlobAddFileId (const void *p_cache,
512  const unsigned char *blob,
513  int size, const char *identifier,
514  const char *ns_id,
515  const char *uri_id,
516  const char *ns_charstr,
517  const char *uri_charstr,
518  unsigned char **new_blob,
519  int *new_size);
520 
542  GAIAGEO_DECLARE int gaiaXmlBlobAddParentId (const void *p_cache,
543  const unsigned char *blob,
544  int size,
545  const char *identifier,
546  const char *ns_id,
547  const char *uri_id,
548  const char *ns_charstr,
549  const char *uri_charstr,
550  unsigned char **new_blob,
551  int *new_size);
552 
568  GAIAGEO_DECLARE char *gaiaXmlBlobGetName (const unsigned char
569  *blob, int size);
570 
586  GAIAGEO_DECLARE char *gaiaXmlBlobGetTitle (const unsigned char
587  *blob, int size);
588 
604  GAIAGEO_DECLARE char *gaiaXmlBlobGetAbstract (const unsigned char
605  *blob, int size);
606 
623  GAIAGEO_DECLARE void gaiaXmlBlobGetGeometry (const unsigned char
624  *blob, int size,
625  unsigned char **blob_geom,
626  int *blob_size);
627 
640  GAIAGEO_DECLARE char *gaiaXmlBlobGetEncoding (const unsigned char
641  *blob, int size);
642 
657  GAIAGEO_DECLARE char *gaiaXmlBlobGetLastParseError (const void *p_cache);
658 
673  GAIAGEO_DECLARE char *gaiaXmlBlobGetLastValidateError (const void *p_cache);
674 
686  GAIAGEO_DECLARE int gaiaIsValidXPathExpression (const void *p_cache,
687  const char *xpath_expr);
688 
703  GAIAGEO_DECLARE char *gaiaXmlBlobGetLastXPathError (const void *p_cache);
704 
721  GAIAGEO_DECLARE int gaiaXmlLoad (const void *p_cache,
722  const char *path_or_url,
723  unsigned char **result, int *size,
724  char **parsing_errors);
725 
751  GAIAGEO_DECLARE int gaiaXmlStore (const unsigned char *blob, int size,
752  const char *path, int indent);
753 
754 #endif /* end LIBXML2: supporting XML documents */
755 
756 #ifdef __cplusplus
757 }
758 #endif
759 
760 #endif /* _GG_XML_H */
GAIAGEO_DECLARE void gaiaXmlBlobCompression(const unsigned char *blob, int in_size, int compressed, unsigned char **result, int *out_size)
Return another XmlBLOB buffer compressed / uncompressed.
GAIAGEO_DECLARE int gaiaIsSldSeVectorStyleXmlBlob(const unsigned char *blob, int size)
Checks if a valid XmlBLOB buffer does contain an SLD/SE Style or not.
GAIAGEO_DECLARE int gaiaIsSvgXmlBlob(const unsigned char *blob, int size)
Checks if a valid XmlBLOB buffer does contain an SVG Symbol or not.
GAIAGEO_DECLARE int gaiaIsIsoMetadataXmlBlob(const unsigned char *blob, int size)
Checks if a valid XmlBLOB buffer does contain an ISO Metadata or not.
GAIAGEO_DECLARE char * gaiaXmlGetInternalSchemaURI(const void *p_cache, const unsigned char *xml, int xml_len)
Return the Internal SchemaURI from a valid XmlDocument.
GAIAGEO_DECLARE char * gaia_libxml2_version(void)
return the LIBXML2 version string
GAIAGEO_DECLARE int gaiaIsSldStyleXmlBlob(const unsigned char *blob, int size)
Checks if a valid XmlBLOB buffer does contain an SLD Style or not.
GAIAGEO_DECLARE char * gaiaXmlTextFromBlob(const unsigned char *blob, int size, int indent)
Extract an XMLDocument from within an XmlBLOB buffer.
GAIAGEO_DECLARE int gaiaXmlBlobSetParentId(const void *p_cache, const unsigned char *blob, int size, const char *identifier, unsigned char **new_blob, int *new_size)
Return a new XmlBLOB (ISO Metadata) by replacing the ParentId value.
GAIAGEO_DECLARE int gaiaXmlLoad(const void *p_cache, const char *path_or_url, unsigned char **result, int *size, char **parsing_errors)
Load an external XML Document.
GAIAGEO_DECLARE int gaiaIsValidXmlBlob(const unsigned char *blob, int size)
Checks if a BLOB actually is a valid XmlBLOB buffer.
GAIAGEO_DECLARE void gaiaXmlBlobGetGeometry(const unsigned char *blob, int size, unsigned char **blob_geom, int *blob_size)
Return the Geometry Buffer from a valid XmlBLOB buffer.
GAIAGEO_DECLARE char * gaiaXmlBlobGetLastParseError(const void *p_cache)
Return the most recent XML Parse error/warning (if any)
GAIAGEO_DECLARE char * gaiaXmlBlobGetName(const unsigned char *blob, int size)
Return the Name from a valid XmlBLOB buffer.
GAIAGEO_DECLARE char * gaiaXmlBlobGetLastValidateError(const void *p_cache)
Return the most recent XML Validate error/warning (if any)
GAIAGEO_DECLARE int gaiaXmlBlobAddFileId(const void *p_cache, const unsigned char *blob, int size, const char *identifier, const char *ns_id, const char *uri_id, const char *ns_charstr, const char *uri_charstr, unsigned char **new_blob, int *new_size)
Return a new XmlBLOB (ISO Metadata) by inserting a FileId value.
GAIAGEO_DECLARE int gaiaXmlBlobAddParentId(const void *p_cache, const unsigned char *blob, int size, const char *identifier, const char *ns_id, const char *uri_id, const char *ns_charstr, const char *uri_charstr, unsigned char **new_blob, int *new_size)
Return a new XmlBLOB (ISO Metadata) by inserting a ParentId value.
GAIAGEO_DECLARE char * gaiaXmlBlobGetEncoding(const unsigned char *blob, int size)
Return the Charset Encoding from a valid XmlBLOB buffer.
GAIAGEO_DECLARE char * gaiaXmlBlobGetTitle(const unsigned char *blob, int size)
Return the Title from a valid XmlBLOB buffer.
GAIAGEO_DECLARE void gaiaXmlToBlob(const void *p_cache, const unsigned char *xml, int xml_len, int compressed, const char *schemaURI, unsigned char **result, int *size, char **parsing_errors, char **schema_validation_errors)
Creates an XmlBLOB buffer.
GAIAGEO_DECLARE int gaiaXmlStore(const unsigned char *blob, int size, const char *path, int indent)
Stores an external XML Document.
GAIAGEO_DECLARE char * gaiaXmlBlobGetSchemaURI(const unsigned char *blob, int size)
Return the SchemaURI from a valid XmlBLOB buffer.
GAIAGEO_DECLARE int gaiaXmlBlobGetDocumentSize(const unsigned char *blob, int size)
Return the XMLDocument size (in bytes) from a valid XmlBLOB buffer.
GAIAGEO_DECLARE char * gaiaXmlBlobGetParentId(const unsigned char *blob, int size)
Return the ParentIdentifier from a valid XmlBLOB buffer.
GAIAGEO_DECLARE int gaiaIsValidXPathExpression(const void *p_cache, const char *xpath_expr)
Checks if a Text string could be a valid XPathExpression.
GAIAGEO_DECLARE int gaiaIsSldSeRasterStyleXmlBlob(const unsigned char *blob, int size)
Checks if a valid XmlBLOB buffer does contain an SLD/SE Style or not.
GAIAGEO_DECLARE void gaiaXmlFromBlob(const unsigned char *blob, int size, int indent, unsigned char **result, int *res_size)
Extract an XMLDocument from within an XmlBLOB buffer.
GAIAGEO_DECLARE int gaiaXmlBlobSetFileId(const void *p_cache, const unsigned char *blob, int size, const char *identifier, unsigned char **new_blob, int *new_size)
Return a new XmlBLOB (ISO Metadata) by replacing the FileId value.
GAIAGEO_DECLARE int gaiaIsSchemaValidatedXmlBlob(const unsigned char *blob, int size)
Checks if a valid XmlBLOB buffer has succesfully passed a formal Schema validation or not...
GAIAGEO_DECLARE char * gaiaXmlBlobGetAbstract(const unsigned char *blob, int size)
Return the Abstract from a valid XmlBLOB buffer.
GAIAGEO_DECLARE int gaiaIsCompressedXmlBlob(const unsigned char *blob, int size)
Checks if a valid XmlBLOB buffer is compressed or not.
GAIAGEO_DECLARE char * gaiaXmlBlobGetFileId(const unsigned char *blob, int size)
Return the FileIdentifier from a valid XmlBLOB buffer.
GAIAGEO_DECLARE char * gaiaXmlBlobGetLastXPathError(const void *p_cache)
Return the most recent XPath error/warning (if any)