|
Packit Bot |
06c835 |
/*
|
|
Packit Bot |
06c835 |
* Summary: Provide Canonical XML and Exclusive XML Canonicalization
|
|
Packit Bot |
06c835 |
* Description: the c14n modules provides a
|
|
Packit Bot |
06c835 |
*
|
|
Packit Bot |
06c835 |
* "Canonical XML" implementation
|
|
Packit Bot |
06c835 |
* http://www.w3.org/TR/xml-c14n
|
|
Packit Bot |
06c835 |
*
|
|
Packit Bot |
06c835 |
* and an
|
|
Packit Bot |
06c835 |
*
|
|
Packit Bot |
06c835 |
* "Exclusive XML Canonicalization" implementation
|
|
Packit Bot |
06c835 |
* http://www.w3.org/TR/xml-exc-c14n
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
* Copy: See Copyright for the status of this software.
|
|
Packit Bot |
06c835 |
*
|
|
Packit Bot |
06c835 |
* Author: Aleksey Sanin <aleksey@aleksey.com>
|
|
Packit Bot |
06c835 |
*/
|
|
Packit Bot |
06c835 |
#ifndef __XML_C14N_H__
|
|
Packit Bot |
06c835 |
#define __XML_C14N_H__
|
|
Packit Bot |
06c835 |
#ifdef LIBXML_C14N_ENABLED
|
|
Packit Bot |
06c835 |
#ifdef LIBXML_OUTPUT_ENABLED
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
#ifdef __cplusplus
|
|
Packit Bot |
06c835 |
extern "C" {
|
|
Packit Bot |
06c835 |
#endif /* __cplusplus */
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
#include <libxml/xmlversion.h>
|
|
Packit Bot |
06c835 |
#include <libxml/tree.h>
|
|
Packit Bot |
06c835 |
#include <libxml/xpath.h>
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
/*
|
|
Packit Bot |
06c835 |
* XML Canonicazation
|
|
Packit Bot |
06c835 |
* http://www.w3.org/TR/xml-c14n
|
|
Packit Bot |
06c835 |
*
|
|
Packit Bot |
06c835 |
* Exclusive XML Canonicazation
|
|
Packit Bot |
06c835 |
* http://www.w3.org/TR/xml-exc-c14n
|
|
Packit Bot |
06c835 |
*
|
|
Packit Bot |
06c835 |
* Canonical form of an XML document could be created if and only if
|
|
Packit Bot |
06c835 |
* a) default attributes (if any) are added to all nodes
|
|
Packit Bot |
06c835 |
* b) all character and parsed entity references are resolved
|
|
Packit Bot |
06c835 |
* In order to achive this in libxml2 the document MUST be loaded with
|
|
Packit Bot |
06c835 |
* following global setings:
|
|
Packit Bot |
06c835 |
*
|
|
Packit Bot |
06c835 |
* xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
|
|
Packit Bot |
06c835 |
* xmlSubstituteEntitiesDefault(1);
|
|
Packit Bot |
06c835 |
*
|
|
Packit Bot |
06c835 |
* or corresponding parser context setting:
|
|
Packit Bot |
06c835 |
* xmlParserCtxtPtr ctxt;
|
|
Packit Bot |
06c835 |
*
|
|
Packit Bot |
06c835 |
* ...
|
|
Packit Bot |
06c835 |
* ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
|
|
Packit Bot |
06c835 |
* ctxt->replaceEntities = 1;
|
|
Packit Bot |
06c835 |
* ...
|
|
Packit Bot |
06c835 |
*/
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
/*
|
|
Packit Bot |
06c835 |
* xmlC14NMode:
|
|
Packit Bot |
06c835 |
*
|
|
Packit Bot |
06c835 |
* Predefined values for C14N modes
|
|
Packit Bot |
06c835 |
*
|
|
Packit Bot |
06c835 |
*/
|
|
Packit Bot |
06c835 |
typedef enum {
|
|
Packit Bot |
06c835 |
XML_C14N_1_0 = 0, /* Origianal C14N 1.0 spec */
|
|
Packit Bot |
06c835 |
XML_C14N_EXCLUSIVE_1_0 = 1, /* Exclusive C14N 1.0 spec */
|
|
Packit Bot |
06c835 |
XML_C14N_1_1 = 2 /* C14N 1.1 spec */
|
|
Packit Bot |
06c835 |
} xmlC14NMode;
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
XMLPUBFUN int XMLCALL
|
|
Packit Bot |
06c835 |
xmlC14NDocSaveTo (xmlDocPtr doc,
|
|
Packit Bot |
06c835 |
xmlNodeSetPtr nodes,
|
|
Packit Bot |
06c835 |
int mode, /* a xmlC14NMode */
|
|
Packit Bot |
06c835 |
xmlChar **inclusive_ns_prefixes,
|
|
Packit Bot |
06c835 |
int with_comments,
|
|
Packit Bot |
06c835 |
xmlOutputBufferPtr buf);
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
XMLPUBFUN int XMLCALL
|
|
Packit Bot |
06c835 |
xmlC14NDocDumpMemory (xmlDocPtr doc,
|
|
Packit Bot |
06c835 |
xmlNodeSetPtr nodes,
|
|
Packit Bot |
06c835 |
int mode, /* a xmlC14NMode */
|
|
Packit Bot |
06c835 |
xmlChar **inclusive_ns_prefixes,
|
|
Packit Bot |
06c835 |
int with_comments,
|
|
Packit Bot |
06c835 |
xmlChar **doc_txt_ptr);
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
XMLPUBFUN int XMLCALL
|
|
Packit Bot |
06c835 |
xmlC14NDocSave (xmlDocPtr doc,
|
|
Packit Bot |
06c835 |
xmlNodeSetPtr nodes,
|
|
Packit Bot |
06c835 |
int mode, /* a xmlC14NMode */
|
|
Packit Bot |
06c835 |
xmlChar **inclusive_ns_prefixes,
|
|
Packit Bot |
06c835 |
int with_comments,
|
|
Packit Bot |
06c835 |
const char* filename,
|
|
Packit Bot |
06c835 |
int compression);
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
/**
|
|
Packit Bot |
06c835 |
* This is the core C14N function
|
|
Packit Bot |
06c835 |
*/
|
|
Packit Bot |
06c835 |
/**
|
|
Packit Bot |
06c835 |
* xmlC14NIsVisibleCallback:
|
|
Packit Bot |
06c835 |
* @user_data: user data
|
|
Packit Bot |
06c835 |
* @node: the curent node
|
|
Packit Bot |
06c835 |
* @parent: the parent node
|
|
Packit Bot |
06c835 |
*
|
|
Packit Bot |
06c835 |
* Signature for a C14N callback on visible nodes
|
|
Packit Bot |
06c835 |
*
|
|
Packit Bot |
06c835 |
* Returns 1 if the node should be included
|
|
Packit Bot |
06c835 |
*/
|
|
Packit Bot |
06c835 |
typedef int (*xmlC14NIsVisibleCallback) (void* user_data,
|
|
Packit Bot |
06c835 |
xmlNodePtr node,
|
|
Packit Bot |
06c835 |
xmlNodePtr parent);
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
XMLPUBFUN int XMLCALL
|
|
Packit Bot |
06c835 |
xmlC14NExecute (xmlDocPtr doc,
|
|
Packit Bot |
06c835 |
xmlC14NIsVisibleCallback is_visible_callback,
|
|
Packit Bot |
06c835 |
void* user_data,
|
|
Packit Bot |
06c835 |
int mode, /* a xmlC14NMode */
|
|
Packit Bot |
06c835 |
xmlChar **inclusive_ns_prefixes,
|
|
Packit Bot |
06c835 |
int with_comments,
|
|
Packit Bot |
06c835 |
xmlOutputBufferPtr buf);
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
#ifdef __cplusplus
|
|
Packit Bot |
06c835 |
}
|
|
Packit Bot |
06c835 |
#endif /* __cplusplus */
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
#endif /* LIBXML_OUTPUT_ENABLED */
|
|
Packit Bot |
06c835 |
#endif /* LIBXML_C14N_ENABLED */
|
|
Packit Bot |
06c835 |
#endif /* __XML_C14N_H__ */
|
|
Packit Bot |
06c835 |
|