[Xml-compile] How to get element and its type information into a hash?

Sonderegger, Markus markus.sonderegger at juliusbaer.com
Fri Mar 3 13:25:50 GMT 2017


Hi all
Background information (skip if not interesting)
I try to solve with XML::Compile therefore sorry if you have to read a few lines more.
SIC (Swiss Interbank Clearing) is migrating this year from proprietary formats to an ISO20022 XML messages like already used in SEPA where they are called pacs messages.
The target of the received payment messages is a z/OS Mainframe application written in COBOL and the content of the message is in a Copybook (fixed length structure analogous to a C struct).
We use IBM Integration Bus (IIB) which parses/serializes XML messages validating against the SIC schemas. IIB has the capability to import Copybooks allowing to serialize/parse these fixed length messages.
The transformation (mapping of the fields) is also done in IIB.
I am looking for a way to create programmatically the Copybook and the mapping statements out of the schema information.
Initially I planned to use XML::LibXML to parse the schema but as I need the logical tree represented by the schema and not just the parsed XML schema tree  I thought there must be a better way and ... I found XML::Compile.

Question
XML::Compile is already doing the hard job namely parsing the schema and building a hash with the type information out of it.
In order to build the Copybook I need access to the element and its type information.
Is there a way to get the below template information into a hash so that I can easily access it in my script?
Or does the walkTree method allow me to get the element name with its type information out of the code reference?

A code snippet or a kind of tutorial is what would help a lot.
Many thanks in advance.
Regards
Markus

# is a x0:Document_CH_pacs008
{ # sequence of FIToFICstmrCdtTrf

  # is a x0:FIToFICustomerCreditTransferV02_CH_pacs008
  FIToFICstmrCdtTrf =>
  { # sequence of GrpHdr, CdtTrfTxInf

    # is a x0:GroupHeader33_CH_pacs008
    GrpHdr =>
    { # sequence of MsgId, CreDtTm, BtchBookg, NbOfTxs, CtrlSum,
      #   TtlIntrBkSttlmAmt, IntrBkSttlmDt, SttlmInf, PmtTpInf,
      #   InstgAgt, InstdAgt

      # is a xs:string
      # length <= 35
      # length >= 1
      MsgId => "example",
_____________________________________________________________
Dr. Markus Sonderegger
Application Integration
Bank Julius Baer & Co. Ltd.
Hohlstrasse 600, P.O. Box, CH-8010 Zurich, Switzerland
Telephone +41 58 88 77281, Telefax +41 58 88 74851
Mobile Phone +41 79 698 09 79
www.juliusbaer.com<http://www.juliusbaer.com>

Julius Baer cares about the environment: Please do not print this e-mail unless you really need to.



*****JuliusBaer Disclaimer***** This e-mail is for the intended recipient only and may contain confidential or privileged information. If you have received this e-mail by mistake, please contact us immediately and completely delete it (and any attachments) and do not forward it or inform any other person of its contents. If you send us messages by e-mail, we take this as your authorisation to correspond with you by e-mail, however, we reserve the right not to execute orders and instructions transmitted by e-mail at any time and without further explanation. If you do not wish to receive any further e-mail correspondence please let us know. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, amended, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. Neither the Julius Baer Group nor the sender accept liability for any errors or omissions in the content of this message which arise as a result of its e-mail transmission. Please note that all e-mail communications to and from the Julius Baer Group may be monitored. This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/xml-compile/attachments/20170303/1be4bfd7/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5812 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.scsys.co.uk/pipermail/xml-compile/attachments/20170303/1be4bfd7/attachment.bin>


More information about the Xml-compile mailing list