c14n.h

Go to the documentation of this file.
00001 /*
00002  * Summary: Provide Canonical XML and Exclusive XML Canonicalization
00003  * Description: the c14n modules provides a
00004  *
00005  * "Canonical XML" implementation 
00006  * http://www.w3.org/TR/xml-c14n
00007  * 
00008  * and an
00009  *
00010  * "Exclusive XML Canonicalization" implementation
00011  * http://www.w3.org/TR/xml-exc-c14n
00012  
00013  * Copy: See Copyright for the status of this software.
00014  * 
00015  * Author: Aleksey Sanin <aleksey@aleksey.com>
00016  */
00017 #ifndef __XML_C14N_H__
00018 #define __XML_C14N_H__    
00019 #ifdef LIBXML_C14N_ENABLED
00020 #ifdef LIBXML_OUTPUT_ENABLED
00021 
00022 #ifdef __cplusplus
00023 extern "C" {
00024 #endif /* __cplusplus */ 
00025 
00026 #include <libxml/xmlversion.h>
00027 #include <libxml/tree.h>
00028 #include <libxml/xpath.h> 
00029 
00030 /*
00031  * XML Canonicazation
00032  * http://www.w3.org/TR/xml-c14n
00033  *
00034  * Exclusive XML Canonicazation
00035  * http://www.w3.org/TR/xml-exc-c14n
00036  *
00037  * Canonical form of an XML document could be created if and only if
00038  *  a) default attributes (if any) are added to all nodes
00039  *  b) all character and parsed entity references are resolved
00040  * In order to achive this in libxml2 the document MUST be loaded with 
00041  * following global setings:
00042  *    
00043  *    xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
00044  *    xmlSubstituteEntitiesDefault(1);
00045  *
00046  * or corresponding parser context setting:
00047  *    xmlParserCtxtPtr ctxt;
00048  *    
00049  *    ... 
00050  *    ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
00051  *    ctxt->replaceEntities = 1;
00052  *    ...
00053  */
00054 
00055 
00056 XMLPUBFUN int XMLCALL       
00057         xmlC14NDocSaveTo    (xmlDocPtr doc,
00058                      xmlNodeSetPtr nodes,
00059                      int exclusive,
00060                      xmlChar **inclusive_ns_prefixes,
00061                      int with_comments, 
00062                      xmlOutputBufferPtr buf);
00063 
00064 XMLPUBFUN int XMLCALL
00065         xmlC14NDocDumpMemory    (xmlDocPtr doc,
00066                      xmlNodeSetPtr nodes,
00067                      int exclusive,
00068                      xmlChar **inclusive_ns_prefixes,
00069                      int with_comments, 
00070                      xmlChar **doc_txt_ptr);
00071 
00072 XMLPUBFUN int XMLCALL
00073         xmlC14NDocSave      (xmlDocPtr doc,
00074                      xmlNodeSetPtr nodes,
00075                      int exclusive,
00076                      xmlChar **inclusive_ns_prefixes,
00077                      int with_comments, 
00078                      const char* filename,
00079                      int compression);
00080 
00081 
00085 typedef int (*xmlC14NIsVisibleCallback) (void* user_data, 
00086                      xmlNodePtr node,
00087                      xmlNodePtr parent);
00088 
00089 XMLPUBFUN int XMLCALL
00090         xmlC14NExecute      (xmlDocPtr doc,
00091                      xmlC14NIsVisibleCallback is_visible_callback,
00092                      void* user_data,                
00093                      int exclusive,
00094                      xmlChar **inclusive_ns_prefixes,
00095                      int with_comments, 
00096                      xmlOutputBufferPtr buf);
00097 
00098 #ifdef __cplusplus
00099 }
00100 #endif /* __cplusplus */
00101 
00102 #endif /* LIBXML_OUTPUT_ENABLED */
00103 #endif /* LIBXML_C14N_ENABLED */
00104 #endif /* __XML_C14N_H__ */
00105 
footer
 SourceForge.net Logo