ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

RPG and XML

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • RPG and XML

    Hi All,

    I've to generate an xml to send data to an Europe governament entity.

    Now I've the xsd schema, so which kind of utility do you suggest to me to generate the xml?

    Until now I've always use sql to make it or brutally written in RPG, and the I registered the schema with the db2 utilities to validate it.

    I didn't know XMLtoolkit. The xml is very complicated, what do you suggest to me learn to use XMLTookit or continue to use SQL?

    Is there any trick to have the empty structure of the Xml starting from the xml schema?

    Many thanks.

    Bye

  • #2
    If you have been doing it the hard way by stringing stuff together then there are a number of better alternatives.
    This article describes on freely available utility. http://ibmsystemsmag.com/ibmi/developer/rpg/xmli/

    There are similar APIs in the powerExt library (free core version) from here: http://www.powerext.com/downloads/

    I have also used CGIDEV2 for the purpose which provides a templating approach.

    Which to use - template or API - depends often on how many optional parts there are own the XML. For example if this is the base doc format:
    <A>
    <B>xxxx</B>
    <C>yyyy</C>
    </A>
    If no value for B is available (or needed) and this is valid:
    <A>
    <B></B>
    <C>yyyy</C>
    </A>
    Then a template system works very well. If however the result has to be:
    <A>
    <C>yyyy</C>
    </A>
    Then an API approach may be better. But either will always be better than stringing stuff out.

    If you want a comparison between the three approaches mentioned here then read the RPG Modernization redbook which compares the options - and it here: Modernizing IBM i Applications from the Database up ... - IBM Redbookshttps://www.redbooks.ibm.com/redbooks/pdfs/sg248185.pdf

    Comment


    • #3
      I have been using CGIDEV2 and templates for many years to generate XML-files.
      If you split the template for XML file into more sections it is fairly simple also to
      generate rather complicated XML formats like OIOUBL.

      Comment

      Working...
      X