c14n.inc 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. (*
  2. * Summary: Provide Canonical XML and Exclusive XML Canonicalization
  3. * Description: the c14n modules provides a
  4. *
  5. * "Canonical XML" implementation
  6. * http://www.w3.org/TR/xml-c14n
  7. *
  8. * and an
  9. *
  10. * "Exclusive XML Canonicalization" implementation
  11. * http://www.w3.org/TR/xml-exc-c14n
  12. * Copy: See Copyright for the status of this software.
  13. *
  14. * Author: Aleksey Sanin <[email protected]>
  15. *)
  16. {$IFDEF LIBXML_C14N_ENABLED}
  17. {$IFDEF LIBXML_OUTPUT_ENABLED}
  18. (*
  19. * XML Canonicazation
  20. * http://www.w3.org/TR/xml-c14n
  21. *
  22. * Exclusive XML Canonicazation
  23. * http://www.w3.org/TR/xml-exc-c14n
  24. *
  25. * Canonical form of an XML document could be created if and only if
  26. * a) default attributes (if any) are added to all nodes
  27. * b) all character and parsed entity references are resolved
  28. * In order to achive this in libxml2 the document MUST be loaded with
  29. * following global setings:
  30. *
  31. * xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
  32. * xmlSubstituteEntitiesDefault(1);
  33. *
  34. * or corresponding parser context setting:
  35. * xmlParserCtxtPtr ctxt;
  36. *
  37. * ...
  38. * ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
  39. * ctxt->replaceEntities = 1;
  40. * ...
  41. *)
  42. {$IFDEF TYPE}
  43. (**
  44. * This is the core C14N function
  45. *)
  46. xmlC14NIsVisibleCallback = function(user_data: pointer; node, parent: xmlNodePtr): cint; EXTDECL;
  47. {$ENDIF}
  48. {$IFDEF FUNCTION}
  49. function xmlC14NDocSaveTo(doc: xmlDocPtr; nodes: xmlNodeSetPtr; exclusive: cint; inclusive_ns_prefixes: xmlCharPtrPtr;
  50. with_comments: cint; buf: xmlOutputBufferPtr): cint; EXTDECL; external xml2lib;
  51. function xmlC14NDocDumpMemory(doc: xmlDocPtr; nodes: xmlNodeSetPtr; exclusive: cint; inclusive_ns_prefixes: xmlCharPtrPtr;
  52. with_comments: cint; doc_txt_ptr: xmlCharPtrPtr): cint; EXTDECL; external xml2lib;
  53. function xmlC14NDocSave(doc: xmlDocPtr; nodes: xmlNodeSetPtr; exclusive: cint; inclusive_ns_prefixes: xmlCharPtrPtr;
  54. with_comments: cint; filename: pchar; compression: cint): cint; EXTDECL; external xml2lib;
  55. function xmlC14NExecute(doc: xmlDocPtr; is_visible_callback: xmlC14NIsVisibleCallback; user_data: pointer;
  56. exclusive: cint; inclusive_ns_prefixes: xmlCharPtrPtr; with_comments: cint; buf: xmlOutputBufferPtr): cint; EXTDECL; external xml2lib;
  57. {$ENDIF}
  58. {$ENDIF} (* LIBXML_OUTPUT_ENABLED *)
  59. {$ENDIF} (* LIBXML_C14N_ENABLED *)