Path: blob/master/venv/Lib/site-packages/lxml/includes/libxml/c14n.h
811 views
/*1* Summary: Provide Canonical XML and Exclusive XML Canonicalization2* Description: the c14n modules provides a3*4* "Canonical XML" implementation5* http://www.w3.org/TR/xml-c14n6*7* and an8*9* "Exclusive XML Canonicalization" implementation10* http://www.w3.org/TR/xml-exc-c14n1112* Copy: See Copyright for the status of this software.13*14* Author: Aleksey Sanin <[email protected]>15*/16#ifndef __XML_C14N_H__17#define __XML_C14N_H__18#ifdef LIBXML_C14N_ENABLED19#ifdef LIBXML_OUTPUT_ENABLED2021#ifdef __cplusplus22extern "C" {23#endif /* __cplusplus */2425#include <libxml/xmlversion.h>26#include <libxml/tree.h>27#include <libxml/xpath.h>2829/*30* XML Canonicazation31* http://www.w3.org/TR/xml-c14n32*33* Exclusive XML Canonicazation34* http://www.w3.org/TR/xml-exc-c14n35*36* Canonical form of an XML document could be created if and only if37* a) default attributes (if any) are added to all nodes38* b) all character and parsed entity references are resolved39* In order to achive this in libxml2 the document MUST be loaded with40* following global setings:41*42* xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;43* xmlSubstituteEntitiesDefault(1);44*45* or corresponding parser context setting:46* xmlParserCtxtPtr ctxt;47*48* ...49* ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS;50* ctxt->replaceEntities = 1;51* ...52*/5354/*55* xmlC14NMode:56*57* Predefined values for C14N modes58*59*/60typedef enum {61XML_C14N_1_0 = 0, /* Origianal C14N 1.0 spec */62XML_C14N_EXCLUSIVE_1_0 = 1, /* Exclusive C14N 1.0 spec */63XML_C14N_1_1 = 2 /* C14N 1.1 spec */64} xmlC14NMode;6566XMLPUBFUN int XMLCALL67xmlC14NDocSaveTo (xmlDocPtr doc,68xmlNodeSetPtr nodes,69int mode, /* a xmlC14NMode */70xmlChar **inclusive_ns_prefixes,71int with_comments,72xmlOutputBufferPtr buf);7374XMLPUBFUN int XMLCALL75xmlC14NDocDumpMemory (xmlDocPtr doc,76xmlNodeSetPtr nodes,77int mode, /* a xmlC14NMode */78xmlChar **inclusive_ns_prefixes,79int with_comments,80xmlChar **doc_txt_ptr);8182XMLPUBFUN int XMLCALL83xmlC14NDocSave (xmlDocPtr doc,84xmlNodeSetPtr nodes,85int mode, /* a xmlC14NMode */86xmlChar **inclusive_ns_prefixes,87int with_comments,88const char* filename,89int compression);909192/**93* This is the core C14N function94*/95/**96* xmlC14NIsVisibleCallback:97* @user_data: user data98* @node: the curent node99* @parent: the parent node100*101* Signature for a C14N callback on visible nodes102*103* Returns 1 if the node should be included104*/105typedef int (*xmlC14NIsVisibleCallback) (void* user_data,106xmlNodePtr node,107xmlNodePtr parent);108109XMLPUBFUN int XMLCALL110xmlC14NExecute (xmlDocPtr doc,111xmlC14NIsVisibleCallback is_visible_callback,112void* user_data,113int mode, /* a xmlC14NMode */114xmlChar **inclusive_ns_prefixes,115int with_comments,116xmlOutputBufferPtr buf);117118#ifdef __cplusplus119}120#endif /* __cplusplus */121122#endif /* LIBXML_OUTPUT_ENABLED */123#endif /* LIBXML_C14N_ENABLED */124#endif /* __XML_C14N_H__ */125126127128