1 /* $Id: xml_save.hpp 482375 2015-10-22 16:10:24Z satskyse $ 2 * =========================================================================== 3 * 4 * PUBLIC DOMAIN NOTICE 5 * National Center for Biotechnology Information 6 * 7 * This software/database is a "United States Government Work" under the 8 * terms of the United States Copyright Act. It was written as part of 9 * the author's official duties as a United States Government employee and 10 * thus cannot be copyrighted. This software/database is freely available 11 * to the public for use. The National Library of Medicine and the U.S. 12 * Government have not placed any restriction on its use or reproduction. 13 * 14 * Although all reasonable efforts have been taken to ensure the accuracy 15 * and reliability of the software and data, the NLM and the U.S. 16 * Government do not and cannot warrant the performance or results that 17 * may be obtained by using this software or data. The NLM and the U.S. 18 * Government disclaim all warranties, express or implied, including 19 * warranties of performance, merchantability or fitness for any particular 20 * purpose. 21 * 22 * Please cite the author in any work or product based on this material. 23 * 24 * =========================================================================== 25 * 26 * Author: Sergey Satskiy, NCBI 27 * Credits: Denis Vakatov, NCBI (API design) 28 * 29 */ 30 31 32 /** @file 33 * Flags for saving XML documents and nodes. 34 **/ 35 36 #ifndef _xmlwrapp_xml_save_hpp_ 37 #define _xmlwrapp_xml_save_hpp_ 38 39 40 namespace xml { 41 42 enum save_options { 43 // Compression level part (16 bit reserved) 44 // Only one value should be picked 45 // Default is no compression 46 save_op_compress_level_1 = 1, ///< better speed 47 save_op_compress_level_2 = 2, 48 save_op_compress_level_3 = 3, 49 save_op_compress_level_4 = 4, 50 save_op_compress_level_5 = 5, 51 save_op_compress_level_6 = 6, 52 save_op_compress_level_7 = 7, 53 save_op_compress_level_8 = 8, 54 save_op_compress_level_9 = 9, ///< smaller size 55 56 57 // Document options part - any number of the options below could be 58 // picked 59 save_op_no_format = 1 << 16, ///< Do not format save output 60 save_op_no_decl = 1 << 17, ///< Drop the xml declaration 61 save_op_no_empty = 1 << 18, ///< No empty tags 62 save_op_no_xhtml = 1 << 19, ///< Disable XHTML1 specific rules 63 save_op_xhtml = 1 << 20, ///< Force XHTML1 specific rules. Ignored if libxml2 version is < 2.7.2 64 save_op_not_as_xml = 1 << 21, ///< Do not force XML serialization on HTML doc. Ignored if libxml2 version is < 2.7.2 65 save_op_as_html = 1 << 22, ///< Force HTML serialization on XML doc. Ignored if libxml2 version is < 2.7.2 66 67 /// Format with non-significant whitespace. Ignored if libxml2 version 68 /// is < 2.7.8. This flag will automatically set the save_op_no_format 69 /// as well due to libxml2 implementation. 70 save_op_with_non_significant_ws = 1 << 23, 71 72 save_op_default = 0 ///< Default is: 73 ///< - no compression 74 ///< - to format save output and 75 ///< - to force XML serialization on HTML doc 76 }; 77 78 typedef int save_option_flags; ///< Bitwise save options mask type and a compression level 79 80 81 /// Canonicalization mode. See "Canonical XML" (http://www.w3.org/TR/xml-c14n) 82 /// or "Exclusive XML Canonicalization" (http://www.w3.org/TR/xml-exc-c14n) 83 enum canonicalization_option { 84 c14n_1_0, ///< Origianal C14N 1.0 spec 85 c14n_exclusive_1_0, ///< Exclusive C14N 1.0 spec 86 c14n_1_1, ///< C14N 1.1 spec 87 sort_attr_and_ns, ///< Essentially it is not a 88 ///< canonicalization. It will do only a 89 ///< part of what c14n does, namely: sort 90 ///< attributes and namespace definitions. 91 ///< The xml declaration will appear in the 92 ///< output regardless if it was a document 93 ///< or a node. 94 sort_attr_and_ns_no_decl ///< Essentially it is not a 95 ///< canonicalization. It will do only a 96 ///< part of what c14n does, namely: sort 97 ///< attributes and namespace definitions. 98 ///< The xml declaration will not appear in 99 ///< the output regardless if it was a 100 ///< document or a node. 101 }; 102 103 enum canonicalization_comments_option { 104 keep_comments, 105 strip_comments 106 }; 107 108 enum canonicalization_format_option { 109 with_formatting, 110 without_formatting 111 }; 112 113 enum canonicalization_node_sort_option { 114 with_node_sorting, 115 without_node_sorting 116 }; 117 118 } // xml namespace 119 120 #endif 121 122