Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 1x 7x 7x 7x 7x 7x 7x 7x 1x 1x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 1x 5x 5x 6x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | const {cx_root} = await import("./cx_root.clas.mjs"); // zcl_abapgit_xml.clas.abap class zcl_abapgit_xml { static INTERNAL_TYPE = 'CLAS'; static INTERNAL_NAME = 'ZCL_ABAPGIT_XML'; static IMPLEMENTED_INTERFACES = []; static ATTRIBUTES = {"MI_IXML": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "IF_IXML", RTTIName: "\\INTERFACE=IF_IXML"});}, "visibility": "O", "is_constant": " ", "is_class": " "}, "MI_XML_DOC": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "IF_IXML_DOCUMENT", RTTIName: "\\INTERFACE=IF_IXML_DOCUMENT"});}, "visibility": "O", "is_constant": " ", "is_class": " "}, "MS_METADATA": {"type": () => {return new abap.types.Structure({ "class": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_METADATA-CLASS"}), "version": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_METADATA-VERSION"})}, "zif_abapgit_definitions=>ty_metadata", undefined, {}, {});}, "visibility": "O", "is_constant": " ", "is_class": " "}, "MV_FILENAME": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "visibility": "O", "is_constant": " ", "is_class": " "}, "C_ABAPGIT_TAG": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "visibility": "O", "is_constant": "X", "is_class": "X"}, "C_ATTR_VERSION": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "visibility": "O", "is_constant": "X", "is_class": "X"}, "C_ATTR_SERIALIZER": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "visibility": "O", "is_constant": "X", "is_class": "X"}, "C_ATTR_SERIALIZER_VERSION": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "visibility": "O", "is_constant": "X", "is_class": "X"}}; static METHODS = {"ERROR": {"visibility": "I", "parameters": {"II_PARSER": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "IF_IXML_PARSER", RTTIName: "\\INTERFACE=IF_IXML_PARSER"});}, "is_optional": " "}}}, "RAISE_VERSION_MISMATCH": {"visibility": "I", "parameters": {"IV_VERS": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}}, "RAISE_EXCEPTION_FOR": {"visibility": "I", "parameters": {"II_ERROR": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "IF_IXML_PARSE_ERROR", RTTIName: "\\INTERFACE=IF_IXML_PARSE_ERROR"});}, "is_optional": " "}}}, "TO_XML": {"visibility": "O", "parameters": {"RV_XML": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_NORMALIZE": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});}, "is_optional": " "}}}, "PARSE": {"visibility": "O", "parameters": {"IV_XML": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}}, "CONSTRUCTOR": {"visibility": "U", "parameters": {"IV_FILENAME": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}}}; constructor() { this.me = new abap.types.ABAPObject(); this.me.set(this); this.INTERNAL_ID = abap.internalIdCounter++; this.FRIENDS_ACCESS_INSTANCE = { "error": this.#error.bind(this), "raise_version_mismatch": this.#raise_version_mismatch.bind(this), "raise_exception_for": this.#raise_exception_for.bind(this), "to_xml": this.to_xml.bind(this), "parse": this.parse.bind(this), }; this.mi_ixml = new abap.types.ABAPObject({qualifiedName: "IF_IXML", RTTIName: "\\INTERFACE=IF_IXML"}); this.mi_xml_doc = new abap.types.ABAPObject({qualifiedName: "IF_IXML_DOCUMENT", RTTIName: "\\INTERFACE=IF_IXML_DOCUMENT"}); this.ms_metadata = new abap.types.Structure({ "class": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_METADATA-CLASS"}), "version": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_METADATA-VERSION"})}, "zif_abapgit_definitions=>ty_metadata", undefined, {}, {}); this.mv_filename = new abap.types.String({qualifiedName: "STRING"}); this.c_abapgit_tag = zcl_abapgit_xml.c_abapgit_tag; this.c_attr_version = zcl_abapgit_xml.c_attr_version; this.c_attr_serializer = zcl_abapgit_xml.c_attr_serializer; this.c_attr_serializer_version = zcl_abapgit_xml.c_attr_serializer_version; } async constructor_(INPUT) { let iv_filename = new abap.types.String({qualifiedName: "STRING"}); if (INPUT && INPUT.iv_filename) {iv_filename.set(INPUT.iv_filename);} this.mi_ixml.set((await abap.Classes['CL_IXML'].create())); this.mi_xml_doc.set((await this.mi_ixml.get().if_ixml$create_document())); this.mv_filename.set(iv_filename); return this; } async #error(INPUT) { let ii_parser = INPUT?.ii_parser; if (ii_parser?.getQualifiedName === undefined || ii_parser.getQualifiedName() !== "IF_IXML_PARSER") { ii_parser = undefined; } if (ii_parser === undefined) { ii_parser = new abap.types.ABAPObject({qualifiedName: "IF_IXML_PARSER", RTTIName: "\\INTERFACE=IF_IXML_PARSER"}).set(INPUT.ii_parser); } if (abap.compare.ne((await ii_parser.get().if_ixml_parser$num_errors()), abap.IntegerFactory.get(0))) { await this.#raise_exception_for({ii_error: (await ii_parser.get().if_ixml_parser$get_error({index: abap.IntegerFactory.get(0)}))}); } if (abap.compare.initial(this.mv_filename)) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: new abap.types.String().set(`Error while parsing XML`)}); } else { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: new abap.types.String().set(`Error while parsing XML file ${abap.templateFormatting(this.mv_filename)}`)}); } } async parse(INPUT) { let iv_xml = INPUT?.iv_xml; if (iv_xml?.getQualifiedName === undefined || iv_xml.getQualifiedName() !== "STRING") { iv_xml = undefined; } if (iv_xml === undefined) { iv_xml = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_xml); } let li_stream_factory = new abap.types.ABAPObject({qualifiedName: "IF_IXML_STREAM_FACTORY", RTTIName: "\\INTERFACE=IF_IXML_STREAM_FACTORY"}); let li_istream = new abap.types.ABAPObject({qualifiedName: "IF_IXML_ISTREAM", RTTIName: "\\INTERFACE=IF_IXML_ISTREAM"}); let li_element = new abap.types.ABAPObject({qualifiedName: "IF_IXML_ELEMENT", RTTIName: "\\INTERFACE=IF_IXML_ELEMENT"}); let li_version = new abap.types.ABAPObject({qualifiedName: "IF_IXML_NODE", RTTIName: "\\INTERFACE=IF_IXML_NODE"}); let li_parser = new abap.types.ABAPObject({qualifiedName: "IF_IXML_PARSER", RTTIName: "\\INTERFACE=IF_IXML_PARSER"}); abap.statements.assert(abap.compare.initial(iv_xml) === false); li_stream_factory.set((await this.mi_ixml.get().if_ixml$create_stream_factory())); li_istream.set((await li_stream_factory.get().if_ixml_stream_factory$create_istream_string({string: iv_xml}))); li_parser.set((await this.mi_ixml.get().if_ixml$create_parser({stream_factory: li_stream_factory, istream: li_istream, document: this.mi_xml_doc}))); await li_parser.get().if_ixml_parser$add_strip_space_element(); if (abap.compare.ne((await li_parser.get().if_ixml_parser$parse()), abap.IntegerFactory.get(0))) { await this.#error({ii_parser: li_parser}); } await li_istream.get().if_ixml_istream$close(); li_element.set((await this.mi_xml_doc.get().if_ixml_document$find_from_name_ns({depth: abap.IntegerFactory.get(0), name: zcl_abapgit_xml.c_abapgit_tag}))); li_version.set((await (await li_element.get().if_ixml_node$get_attributes()).get().if_ixml_named_node_map$get_named_item_ns({name: zcl_abapgit_xml.c_attr_version}))); if (abap.compare.ne((await li_version.get().if_ixml_node$get_value()), abap.Classes['ZIF_ABAPGIT_VERSION'].zif_abapgit_version$c_xml_version)) { await this.#raise_version_mismatch({iv_vers: (await li_version.get().if_ixml_node$get_value())}); } this.ms_metadata.get().class.set((await li_element.get().if_ixml_element$get_attribute_ns({name: zcl_abapgit_xml.c_attr_serializer}))); this.ms_metadata.get().version.set((await li_element.get().if_ixml_element$get_attribute_ns({name: zcl_abapgit_xml.c_attr_serializer_version}))); } async #raise_exception_for(INPUT) { let ii_error = INPUT?.ii_error; if (ii_error?.getQualifiedName === undefined || ii_error.getQualifiedName() !== "IF_IXML_PARSE_ERROR") { ii_error = undefined; } if (ii_error === undefined) { ii_error = new abap.types.ABAPObject({qualifiedName: "IF_IXML_PARSE_ERROR", RTTIName: "\\INTERFACE=IF_IXML_PARSE_ERROR"}).set(INPUT.ii_error); } let lv_message = new abap.types.String({qualifiedName: "STRING"}); lv_message.set(abap.operators.concat(new abap.types.String().set(`XML parser error: ${abap.templateFormatting((await ii_error.get().if_ixml_parse_error$get_reason()))}, `),abap.operators.concat(new abap.types.String().set(`Line ${abap.templateFormatting((await ii_error.get().if_ixml_parse_error$get_line()))} `),new abap.types.String().set(`Col. ${abap.templateFormatting((await ii_error.get().if_ixml_parse_error$get_column()))}`)))); if (abap.compare.initial(this.mv_filename) === false) { lv_message.set(abap.operators.concat(lv_message,new abap.types.String().set(` File ${abap.templateFormatting(this.mv_filename)}`))); } await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: lv_message}); } async #raise_version_mismatch(INPUT) { let iv_vers = INPUT?.iv_vers; if (iv_vers?.getQualifiedName === undefined || iv_vers.getQualifiedName() !== "STRING") { iv_vers = undefined; } if (iv_vers === undefined) { iv_vers = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_vers); } let lv_text = new abap.types.String({qualifiedName: "STRING"}); lv_text.set(new abap.types.String().set(`The XML versions do not match, expected: ${abap.templateFormatting(abap.Classes['ZIF_ABAPGIT_VERSION'].zif_abapgit_version$c_xml_version)}, actual: ${abap.templateFormatting(iv_vers)}`)); if (abap.compare.initial(this.mv_filename) === false) { lv_text.set(abap.operators.concat(lv_text,new abap.types.String().set(`, file: ${abap.templateFormatting(this.mv_filename)}`))); } lv_text.set(abap.operators.concat(lv_text,new abap.types.String().set(` (see https://docs.abapgit.org/other-xml-mismatch.html)`))); await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: lv_text}); } async to_xml(INPUT) { let rv_xml = new abap.types.String({qualifiedName: "STRING"}); let iv_normalize = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}); if (INPUT && INPUT.iv_normalize) {iv_normalize.set(INPUT.iv_normalize);} if (INPUT === undefined || INPUT.iv_normalize === undefined) {iv_normalize = abap.builtin.abap_true;} let li_ostream = new abap.types.ABAPObject({qualifiedName: "IF_IXML_OSTREAM", RTTIName: "\\INTERFACE=IF_IXML_OSTREAM"}); let li_renderer = new abap.types.ABAPObject({qualifiedName: "IF_IXML_RENDERER", RTTIName: "\\INTERFACE=IF_IXML_RENDERER"}); let li_streamfactory = new abap.types.ABAPObject({qualifiedName: "IF_IXML_STREAM_FACTORY", RTTIName: "\\INTERFACE=IF_IXML_STREAM_FACTORY"}); li_streamfactory.set((await this.mi_ixml.get().if_ixml$create_stream_factory())); li_ostream.set((await li_streamfactory.get().if_ixml_stream_factory$create_ostream_cstring({string: rv_xml}))); li_renderer.set((await this.mi_ixml.get().if_ixml$create_renderer({ostream: li_ostream, document: this.mi_xml_doc}))); await li_renderer.get().if_ixml_renderer$set_normalizing({normal: iv_normalize}); await li_renderer.get().if_ixml_renderer$render(); return rv_xml; } } abap.Classes['ZCL_ABAPGIT_XML'] = zcl_abapgit_xml; zcl_abapgit_xml.c_abapgit_tag = new abap.types.String({qualifiedName: "STRING"}); zcl_abapgit_xml.c_abapgit_tag.set('abapGit'); zcl_abapgit_xml.c_attr_version = new abap.types.String({qualifiedName: "STRING"}); zcl_abapgit_xml.c_attr_version.set('version'); zcl_abapgit_xml.c_attr_serializer = new abap.types.String({qualifiedName: "STRING"}); zcl_abapgit_xml.c_attr_serializer.set('serializer'); zcl_abapgit_xml.c_attr_serializer_version = new abap.types.String({qualifiedName: "STRING"}); zcl_abapgit_xml.c_attr_serializer_version.set('serializer_version'); export {zcl_abapgit_xml}; |