主页 > 专属服务器 > > 正文

对象存储_魔道祖师番外百度云_排行榜

来源:胜利云 发布时间:2022-04-23 09:20 标签:百度排行榜存储祖师对象魔道番外
浏览:

对象存储_魔道祖师番外百度云_排行榜

I’m not entirely sure if a similar solution exists; I’ve tried searching through blog posts in the ABAP Development space and couldn’t find any match (although there are over 1000 results for "abap xml").

Basically, more out of boredom and willing to learn more about the capabilities of the iXML Library, I made an ABAP/4 class that can transform any data (simple data, structure, table type) at any depth into XML format and vice versa. Even though, bringing XML to ABAP/4 only matches elements with the same name, ignoring extra data.

For example:

Given the following nested-structured local transparent table:

DATA :  BEGIN OF ls_data.        INCLUDE STRUCTURE spfli.DATA :      scarr   TYPE scarr,      sflight TYPE sflight_tab1,    END OF ls_data,  lt_data LIKE TABLE OF ls_data.

Filled with test data:

SELECT *       UP TO 10 ROWS       FROM spfli       INTO CORRESPONDING FIELDS OF TABLE lt_data.

FIELD-SYMBOLS : LIKE LINE OF lt_data.LOOP AT lt_data ASSIGNING .  SELECT SINGLE *                FROM scarr                INTO CORRESPONDING FIELDS OF –scarr                WHERE carrid = –carrid.

SELECT *         FROM sflight         INTO CORRESPONDING FIELDS OF TABLE –sflight         WHERE carrid = –carrid           AND connid = –connid.ENDLOOP.

The result is:

The class looks as follows (I will also attach it as text at the bottom together with the demo report):

class ZCL_XML_UTIL definition  public  create public .

public section.*"* public components of class ZCL_XML_UTIL*"* do not include other source files here!!!

methods CONSTRUCTOR .  methods ABAP_TO_XML    importing      !IM_DATA type ANY    exporting      !EX_CONTENT type XSTRING    raising      ZCX_TYPE_NOT_SUPPORTED .  methods XML_TO_ABAP    importing      !IM_CONTENT type XSTRING    exporting      !EX_DATA type ANY    raising      ZCX_TYPE_NOT_SUPPORTED .protected section.*"* protected components of class ZCL_XML_UTIL*"* do not include other source files here!!!

data MO_IXML type ref to IF_IXML .  data MO_DOCUMENT type ref to IF_IXML_DOCUMENT .private section.*"* private components of class ZCL_XML_UTIL*"* do not include other source files here!!!

methods PROCESS    importing      !IM_NODE type ref to IF_IXML_NODE      !IM_NAME type STRING      !IM_DATA type ANY    raising      ZCX_TYPE_NOT_SUPPORTED .  methods CREATE_ELEMENT    importing      !IM_NAME type STRING      !IM_VALUE type STRING optional    returning      value(RE_ELEMENT) type ref to IF_IXML_ELEMENT .  methods TRAVERSE    importing      !IM_CURRENT_NODE type ref to IF_IXML_NODE    changing      !CH_DATA type ANY    raising      ZCX_TYPE_NOT_SUPPORTED .  class-methods AS_STRING    importing      !IM_DATA type ANY    returning      value(RE_DATA_STRING) type STRING .ENDCLASS.

CLASS ZCL_XML_UTIL IMPLEMENTATION.

* —————————————————————————————+* | Instance Public Method ZCL_XML_UTIL->ABAP_TO_XML* +————————————————————————————————-+* | [—>] IM_DATA                        TYPE        ANY* | [create_document( ).

* set encoding to UTF-8 (Unicode Transformation Format)* 8-bit variable-width encoding maximizes compatibility with ASCII  mo_document->set_encoding( mo_ixml->create_encoding(      byte_order    = 0      character_set = ‘UTF-8’ ) ).

IF NOT im_data IS INITIAL.*   use mo_document as root    process( im_node = mo_document             im_name = ‘data’             im_data = im_data ).  ENDIF.

* render .xml document with output stream  mo_document->render(    ostream = mo_ixml->create_stream_factory( )->create_ostream_xstring(      string = ex_content ) ).  FREE : mo_document.

ENDMETHOD.

* —————————————————————————————+* | Static Private Method ZCL_XML_UTIL=>AS_STRING* +————————————————————————————————-+* | [—>] IM_DATA                        TYPE        ANY* | [CONSTRUCTOR* +————————————————————————————————-+* +————————————————————————————–METHOD CONSTRUCTOR.

* get iXML library instance  mo_ixml = cl_ixml=>create( ).

ENDMETHOD.

* —————————————————————————————+* | Instance Private Method ZCL_XML_UTIL->CREATE_ELEMENT* +————————————————————————————————-+* | [—>] IM_NAME                        TYPE        STRING* | [—>] IM_VALUE                       TYPE        STRING(optional)* | [create_element( name = lv_name ).

* if element is leaf, set corresponding value  IF im_value IS SUPPLIED.    re_element->set_value( im_value ).  ENDIF.

ENDMETHOD.

发表评论
验证码: 点击我更换图片

注:网友评论仅供其表达个人看法,并不代表本站立场。

热门文章

  • 亚马逊云_海报cdn_优惠券
    <strong>亚马逊云_海报cdn_优惠券</strong>

    亚马逊云_海报cdn_优惠券

    消费者在哪里?这不是医疗保健领域的"捉迷藏"游戏,而是建立一个全面运转的医疗保健系统所需要的关键缺失要素。让消费者参与进来——作为一个消费...

  • 云解析_svn服务器安装_限时特惠
    <strong>云解析_svn服务器安装_限时特惠</strong>

    云解析_svn服务器安装_限时特惠

    集成/docker/梅索斯/marathonapachemesos是一个用于调度和管理分布式应用程序的开源集群管理器。Mesos几乎就像整个集群是一个单一的集群一样分配CPU和RAM等资源...

  • 云服务器_阿里云服务器账号_哪家好
    <strong>云服务器_阿里云服务器账号_哪家好</strong>

    云服务器_阿里云服务器账号_哪家好

    技术支持副总裁Aileen Wyer和高级系统管理员Maruf Rahman最近与我们坐下来讨论我们的合作伙伴关系如何帮助CAN Capital的遗留备份基础设施现代化,以简化数据管...

  • 消息队列_折枝by困倚危楼百度云_新注册优
    <strong>消息队列_折枝by困倚危楼百度云_新注册优</strong>

    消息队列_折枝by困倚危楼百度云_新注册优

    今天,两位前行业分析师(现在是Veeam高管)讨论了塑造数据保护行业和IT格局的趋势:Jason Buffington@JBuff,前ESG数据保护首席分析师Dave Russell@BackupDave,Ga...

  • 中间件_服务器能干什么_超低折扣
    <strong>中间件_服务器能干什么_超低折扣</strong>

    中间件_服务器能干什么_超低折扣

    Nathan Sielaff,World Vision的系统工程师,负责备份、存储等。他致力于创建一个灵活和敏捷的IT环境,这样组织就不必担心底层基础设施,可以将精力集中在任...

云储存

更多 >
  • <strong>企业邮箱_百度云资源电影_哪个好</strong>
    企业邮箱_百度云资源电影_哪个好

    当SAP发布SAP Smart Financials时,我非常激动,原因如下: 这真的很激动人心,如果您不熟悉这个新的解决方案,我建议您阅读以下博客: 在SAPPHIRE NOW的主题演...

  • <strong>天翼云_dnf连接服务器失败_超低折扣</strong>
    天翼云_dnf连接服务器失败_超低折扣

    当你坐在一家餐厅里,你仔细阅读着电子平板电脑上的菜单。不知道要点什么?没问题,这是一家您经常去的餐厅,因此会根据您的喜好为您提供菜单建议...

云储存对象存储_哪里有免费云服务器_哪个好
云储存金山云_服务器教程_学生机
云储存文件存储_网云解析_怎么样
云储存云存储_cdn存储_企业级
云储存MySQL数据库_哈尔滨公司网站建设_免费