Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-12 09:14:53

0001 /**
0002  * @file
0003  * 
0004  * @brief Provide Canonical XML and Exclusive XML Canonicalization
0005  * 
0006  * the c14n modules provides a
0007  *
0008  * "Canonical XML" implementation
0009  * http://www.w3.org/TR/xml-c14n
0010  *
0011  * and an
0012  *
0013  * "Exclusive XML Canonicalization" implementation
0014  * http://www.w3.org/TR/xml-exc-c14n
0015 
0016  * @copyright See Copyright for the status of this software.
0017  *
0018  * @author Aleksey Sanin
0019  */
0020 #ifndef __XML_C14N_H__
0021 #define __XML_C14N_H__
0022 
0023 #include <libxml/xmlversion.h>
0024 
0025 #ifdef LIBXML_C14N_ENABLED
0026 
0027 #include <libxml/tree.h>
0028 #include <libxml/xpath.h>
0029 
0030 #ifdef __cplusplus
0031 extern "C" {
0032 #endif /* __cplusplus */
0033 
0034 /*
0035  * XML Canonicalization
0036  * http://www.w3.org/TR/xml-c14n
0037  *
0038  * Exclusive XML Canonicalization
0039  * http://www.w3.org/TR/xml-exc-c14n
0040  *
0041  * Canonical form of an XML document could be created if and only if
0042  *  a) default attributes (if any) are added to all nodes
0043  *  b) all character and parsed entity references are resolved
0044  * In order to achieve this in libxml2 the document MUST be loaded with
0045  * following options: XML_PARSE_DTDATTR | XML_PARSE_NOENT
0046  */
0047 
0048 /**
0049  * Predefined values for C14N modes
0050  */
0051 typedef enum {
0052     /** Original C14N 1.0 spec */
0053     XML_C14N_1_0            = 0,
0054     /** Exclusive C14N 1.0 spec */
0055     XML_C14N_EXCLUSIVE_1_0  = 1,
0056     /** C14N 1.1 spec */
0057     XML_C14N_1_1            = 2
0058 } xmlC14NMode;
0059 
0060 XMLPUBFUN int
0061         xmlC14NDocSaveTo    (xmlDoc *doc,
0062                      xmlNodeSet *nodes,
0063                      int mode, /* a xmlC14NMode */
0064                      xmlChar **inclusive_ns_prefixes,
0065                      int with_comments,
0066                      xmlOutputBuffer *buf);
0067 
0068 XMLPUBFUN int
0069         xmlC14NDocDumpMemory    (xmlDoc *doc,
0070                      xmlNodeSet *nodes,
0071                      int mode, /* a xmlC14NMode */
0072                      xmlChar **inclusive_ns_prefixes,
0073                      int with_comments,
0074                      xmlChar **doc_txt_ptr);
0075 
0076 XMLPUBFUN int
0077         xmlC14NDocSave      (xmlDoc *doc,
0078                      xmlNodeSet *nodes,
0079                      int mode, /* a xmlC14NMode */
0080                      xmlChar **inclusive_ns_prefixes,
0081                      int with_comments,
0082                      const char* filename,
0083                      int compression);
0084 
0085 
0086 /**
0087  * This is the core C14N function
0088  */
0089 /**
0090  * Signature for a C14N callback on visible nodes
0091  *
0092  * @param user_data  user data
0093  * @param node  the current node
0094  * @param parent  the parent node
0095  * @returns 1 if the node should be included
0096  */
0097 typedef int (*xmlC14NIsVisibleCallback) (void* user_data,
0098                      xmlNode *node,
0099                      xmlNode *parent);
0100 
0101 XMLPUBFUN int
0102         xmlC14NExecute      (xmlDoc *doc,
0103                      xmlC14NIsVisibleCallback is_visible_callback,
0104                      void* user_data,
0105                      int mode, /* a xmlC14NMode */
0106                      xmlChar **inclusive_ns_prefixes,
0107                      int with_comments,
0108                      xmlOutputBuffer *buf);
0109 
0110 #ifdef __cplusplus
0111 }
0112 #endif /* __cplusplus */
0113 
0114 #endif /* LIBXML_C14N_ENABLED */
0115 #endif /* __XML_C14N_H__ */
0116