Home

LDX+ XML Generator - User Manual

image

Contents

1. lt namercontents of embedded contained within Ct name gt lt contained gt lt belement gt contents of belement within C lt helement gt lt celement C third lt celement gt lt C gt Processing complete Dijkstra ICT Consulting LDX Generator User Manual v 2 2 Pg 12 14 ww LDX Gene ra ICT Consu Iting ro Manual v 2 2 6 2 3 Configuration process container container process true Command Java jar subst jar input subst xml schema subst xsd prop substCon prop 6 2 4 Configuration process container container process true process C container C detach true container C process true This one is interesting it tells the framework to process the container and to process and detach C Both A and B will be contained in the container whereas C will be processed separately Property file substCon prop unning with properties file prop substCon prop Starting application Processing container A gt aelement gt A firstiraelement gt containedA gt name gt contentes of embedded containedA within A lt name gt contained gt aelement gt B firstiraelement gt containedA gt name gt contents of embedded containedA within B lt name gt fcontainedAa gt be lement gt B second lt be lement gt aelement gt C firstiraelement gt containedA gt name gt contentes of embedded containedA within C lt name
2. 3ALDA 2 1 1 gt java jar ldx g jar ctutorialrsubstrconfrcfy xml Starting Generator Validating configuration Initializing generator Generating source code based on subst xsd in tutorial subst sre Done K SLDA 2 1 1 gt The ldxg jar previously ldx g jar is the generator The generator takes the following options C the name of the configuration the generator should use p instructs the code generator to include the methods for printing the default is to exclude them NOTE The latest version of LDX 2 1 2 comes with scripts that rely on an environment variable LDX_HOME which is to be set to the path where LDX is installed 5 5 MessageHandler The message handler root tells the generator which element is the root element By default the generator uses the corresponding type name from the XML schema to generate the Java data class and Java handler class However in the case of SEPA in every XML schema the root type is Document Consequently following the default the generator would overwrite the messageHandler for every schema i e pain 001 pain 002 etc For SEPA the best way to prevent this from happening is by instructing the generator to use an alternative name for the type using the root type rename attribute For example fig 1 the generator substitutes PainO01VO3Document for type Document in the case of pain 001 001 03 xsd This is because within the standard all types have unique names except f
3. 5 4 message handler name The name of the generated messageHandler class This class reads the XML document from an input source message handler The name of the optionally generated MessageProcessor class processor optional message handler The name of the optionally generated ParserApplication class application optional The messageHandler automatically positions at the handler root the handler root element is the first in the hierarchy that is processed Dijkstra ICT Consulting LDX Generator User Manual v 2 2 Pg 7 14 Dijkstra ICT Consulting LDX Generator User Manual v 2 2 lt xml version 1 0 encoding utf 8 2 gt lt ldx generator emlns xsi http wew w3 org 2 001 XMLSchema instance xmins orn ldx dijkstra ict nl gt E lt domain name sepa D09 gt lt all X5Ds of one module are to be placed in the same folder gt lt the module name is used as an extension for generation of the package name gt module name pain input path samples sepa schema output path samples sepa pain sro gt lt for each XSD the root type to be handled and the name of the handler class are specified gt interface name pain 002 001 03 x d message handler root Document root type rename Pain002Y03Document message handler name Pain002V03MessageHandler gt lt interface name pain 007 001 02 x d message handler root Dbocument root type ren
4. code using the generator 2 Prerequisites To use the LDX XML Generator 2 2 You MUST have Java 1 7 or later For backward 1 5 compatibility contact support only small differences particularly the Java multi catch statement You MUST have a valid license for the LDX XML Framework 2 2 this may be an evaluation license 3 Changes from previous versions LDX v 2 2 v The generator configuration now supports Java serialization v The generator generates equals methods v The generated code is based on the framework version 2 2 which was also updated for this release v detached is now detach detached is ignored v The namespace dijkstra ict com has changed xml2java net configuration XSD This impacts the configuration file of the code generator v New and additional optional command line options o a author If it contains spaces write as follows a John Doe o h followed by the name of the text file that contains the custom header name is relative to where the generator command is used o sluid serialization support with uid serialVersionUID this parameter allows you to control the versionUID for different versions of the XML Schema Only numeric characters Do not include L at the end of the string o W working directory other command line options including paths as well as configuration options used in the generator configuration file are relative to this path LDX v 2 1 v Th
5. tag poram parent the parent data public BType String elementName ComplexDataType parent superCelementName parent We find that the BType extends AType Further within the container class there is a list of AType resembling the XML Schema model f list of A element private ArrayList lt AType gt m_ alist new ArrayList lt AType gt 6 2 Input and runtime configuration Now we have a look at the input lt xml velrsion 1 0 encoding utf 8 gt lt container xmlns xs http www w3 org 2001 XMLSchema xmlns http dijkstra ict com test subst gt lt A gt faelement gt A first lt aelement gt lt containedsA gt lt name gt contents of embedded containedA within A lt name gt lt containedA gt lt A gt lt B gt lt aelement gt B first lt aelement gt lt containedA gt lt name gt contents of embedded containedA within B lt name gt lt containedA gt lt belement gt B second lt belement gt lt B gt lt C gt lt aelement gt C first lt aelement gt lt containedA gt lt name gt contents of embedded containedA within C lt name gt lt containedA gt lt belement gt contents of belement within C lt belement gt lt celement t third lt celement gt lt C gt lt container gt We see that we have a container with tree elements one of each type The processor we built just prints out the Java objects sent by the framework Dijkstra ICT Consulting LDX Generator User Manual v
6. 2 2 Pg 11 14 Dijkstra ICT Consulting LDX Generator User Manual v 2 2 We can run this sample in a variety of ways 6 2 1 Property file substA prop Configuration M el framework tutorial subst run proprsubst prop process A Running with properties file proprsubst prop container A detach true Starting application container A process true Processing A gt ae lement A first lt ae lement gt contained gt namescontents of embedded contained within 4r name gt This tells the framework two things A should be detached from its parent rE container Pace ing complete A should be processed that is sent to the processor Output 6 2 2 Property file substABC prop Configuration f KIATESTALDA 2 1 framework tutorialsubst gt run proprsubstABC prop process A Running with properties file prop substABC prop container A detach true Starting application container A process true Processing lt A gt process B lt aelement gt A first lt ae lement gt container B detach true containeda gt container B process true lt namercontents of embedded containedA within A lt name gt lt containedhA gt process C container C detach true lt aelement gt B first lt ae lement gt container C process true lt containedfA gt name gt contents of embedded contained within Bt name gt xe contained gt lt belement gt B second lt rbelement gt
7. EE ETE TH 5 1 2 Custom serialVersionUID s The option s followed by a number causes the generator to use that number as the serialVersionUID The above command would generate JxF default serial version UID private static final long serialVersionUID 3L in the source code of the generated classes This enables the use of difference serialVersionUIDs for different versions of the underlying XML schema Dijkstra ICT Consulting LDX Generator User Manual v 2 2 Pg 5 14 Dijkstra ICT Consulting LDX Generator User Manual v 2 2 5 2 Configuration Before you can use the generator to generate code for your project you need to configure it The configuration file is shown in figure 1 Bimi version 1 0 encoding utf 8 BN lt 1ldx generator xmins xsi http me w3 0rg 2001 HMLSchema instance zxmins uorn ldx dijkstra ict nl gt E A generator configuration has precisely 1 domain element indicating the domain for which code generation is performed The base package defaults to com ldx but can have any value of your liking to change its value use the base attribute In this case base is set to com xyz The domain name is added to the package name giving com xXyz tutorial lt domain base com xyz name tutorial gt Within a domain multiple modules may be present For each module the module name is added to the domain package in this case giving com xyz tutorial ext gt lt m
8. LDX XML Generator USER MANUAL VERSION 2 2 Dijkstra ICT Consulting LDX Generator User Manual v 2 2 Table of Contents FOVERE V did 3 2 PREREQUISITE Siara a a a 3 3 CHANGES FROM PREVIOUS VERSIONS ccccceceecceceeceeceeceeceeneeneeseenesceeaeeaeeaeeaeeaneeneaneaneeaneeeanes 3 4 PREPARAT ON cad 4 J USA DE a a a a 5 dl COMMAND EINE OPTIONS iain A a A ai 5 SE CUSTOM Header a a a detritos de 5 51 2 Custom s ra Veo OU D Sd 5 52 CONFIGURATION coren a added 6 5 3 CONFIGURATION EXAMPLES ccccceccecccccecceccccccccesceceeaeeaceceuantaetaeeneeaneastanesntantsnesnesntantsntsntennetsanens 8 5A GENERATOR UN VO CA TON e ee au id E ne 9 59 IES SAGER ANDER ads 9 5 EXAMPLES as 10 S L THE SUBST AMS CHEMA a e lo dentate 10 6 2 INPUT AND RUNTIME CONFIGURATION cceccecceccceceacenceeecaeeceeaceaeeneegeeaneaeeaeenatgueegaeengeettnneennnnntnaners 11 0 2 t Propeny TIe SUDSIA DIO A da esds 12 0 2 2 Property file SUDSIAB CDI OD sao ii ii acceda 12 0235 Property TIE SUSO DIO os 13 6 2 4 Prone Mle SUDSLC ONC DI OD sentis a ico crtalatebite 13 7 FEATURES AND LIMITATIONS ccccceececceccencecceceenceneeceeneeaeeaceaneaneaneaneaneaneuneeneaneuueeesaueusaueesuneneas 14 Dijkstra ICT Consulting LDX Generator User Manual v 2 2 Pg 2 14 Dijkstra ICT Consulting LDX Generator User Manual v 2 2 1 Overview This document describes the steps to set up the LDX XML Generator v 2 2 and the steps required generating
9. above excerpt illustrates the family of types AType BType and CType of which AType is the super type In Java we modelled this using an extends relationship lt xsd element nome A type AType gt lt xsd element name B substitutionGroup A type BType gt lt xsd element name C substitutionGroup B type CType gt lt xsd element name container gt lt xsd complexType gt lt xsd sequence gt lt xsd element ref A minOccurs B0 maxOccurs unbounded gt lt xsd sequence gt lt xsd complexType gt lt xsd element gt Dijkstra ICT Consulting LDX Generator User Manual v 2 2 Pg 10 14 Dijkstra ICT Consulting LDX Generator User Manual v 2 2 The element declaration section tells the Schema processor that B and C may be substituted wherever A occurs The precondition for such element substitution being that the corresponding sub types are extensions from the base type The final container type embeds a collection of A elements Now let s have a quick look at the generated Java code fee EType data class w This class is the data class for type BType The class provides getters and setters for embedded attributes and elements A complex data structure can be navigated by using the element getter methods ie k ee lt BTypeHandler gt Sauthor Lolke B Dijkstra ty public class BType extends AType Constructor for BType sk param elementName the name of the originating XML
10. ame Pain0D7W02Document message handler name Pain00T7VW02MessageHandler gt lt interface name pain 008 001 02 x d message handler root Dbocument root type rename Pain008 Y02Document message handler name Pain008VW02MessageHandler gt lt module gt lt domain gt lt 1dx generator gt Figure 2 Generator Configuration According to the example configuration the LDX Generator reads the schemata from the subdirectory samples sepa schema and generates the sources into subdirectory samples sepa pain src The highlighted section in Figure 2 illustrates the usage of the optional message handler application and message handler processor attributes 5 3 Configuration Examples Example 1 Generate code for all of the pain messages in a package named com mycompany sepa payments To do this domain base would be com mycompany and module name would be payments instead of pain Example 2 Generate all of the pain and pacs messages in a package named com dx sepa payments Dijkstra ICT Consulting LDX Generator User Manual v 2 2 Pg 8 14 Dijkstra ICT Consulting LDX Generator User Manual v 2 2 To do this for each of the pacs XSD files an interface element must be added to the configuration file 5 4 Generator Invocation Once configured using the generator from the command line terminal window is straightforward Assuming Java has been properly set up at the prompt type the following command K
11. ame followed by the module attribute name e g com xyz tutorial ext The messageHandlers are generated in a subpackage handlers e g com xyz tutorial ext handlers Dijkstra ICT Consulting LDX Generator User Manual v 2 2 Pg 6 14 Dijkstra ICT Consulting LDX Generator User Manual v 2 2 For each module the following information must be provided name the module name see above input path the directory where the generator looks for the schemata one per interface output path the directory where the generator outputs the source code A module has one or more interfaces each of which is specified by the interface element Each interface relates to precisely one schema file XSD For each interface the following information is provided name The name of the corresponding schema XSD message handler root The name of the XML e ement that is the root element of the instance document root type rename The name the type the generator will substitute for the root type It is optional used to prevent type name collisions This will also change the root type handler since it is derived from the root type by appending Handler to the name For example within SEPA for all interfaces XML Schema files the type of the root element is Document not to be confused with the name of the root element which also happens to be Document Figure 2 shows it is renamed to be unique For more information please refer to section
12. e generator configuration now supports overriding the com ldx base for enhanced flexibility v The generated code is based on the framework version 2 1 which was also updated for this release v An optional Application class is generated which extends class ParserApplication This application class generates the glue code between reader and processor component v An optional Processor component is generated which extends the framework MessageProcessor class Together with the Application component this allows for the generated code to compile to a working program from the start All that you need to do is customize the application component and the processor component to suit your needs Dijkstra ICT Consulting LDX Generator User Manual v 2 2 Pg 3 14 Dijkstra ICT Consulting LDX Generator User Manual v 2 2 Y Runtime configuration files now must start with LDX PROPERTIES LDX v 2 0 Y From version 2 0 the code generator is included in the product v This release was enhanced to support recursion and substitution groups anonymous type definitions and supports modular schema definition using include Y A MessageHandler class is generated allowing easy integration of the generated code 4 Preparation Unpack the file Idx zip into a local directory on the development workstation Define an environment variable LDX_HOME This must point to the root of your LDX installation After unpacking seen from the directory in
13. gt fcontainedA gt be lement gt contents of belement within lt belement gt celement gt C thirdircelement gt AG gt Property file substConC prop K TESTSLDX 2 1 framework tutorial subst gt run prop substConC prop Running with properties file prop substConC prop Starting application Processing lt C gt lt aelement gt C first lt ae lement gt lt containedA gt lt hame gt contents of embedded containedA within C lt name gt lt containedA gt lt helement gt contents of belement within C lt belement gt lt celement gt C third lt ce lement gt lt aelement gt A first lt ae lement gt lt containedA gt lt namescontents of embedded containedA within A lt name gt lt containedA gt lt A gt lt B gt aelement gt B firsti aelement gt lt containedA gt lt namescontents of embedded containedA within B lt name gt lt containedA gt lt he lement gt B second lt be lement gt lt B gt lt container gt Processing complete Dijkstra ICT C onsu Iting LDX Generator User Manual v 2 2 Pg 13 14 Dijkstra ICT Consulting LDX Generator User Manual v 2 2 7 Features and Limitations LDX 2 x is a major upgrade from LDX SEPA Framework 1 x No longer is it limited to the SEPA domain and the generator has become part of the product Consequently in the new LDX 2 x a lot of features were added among which s
14. ng LDX Generator User Manual v 2 2 Pg 4 14 Dijkstra ICT Consulting LDX Generator User Manual v 2 2 9 Usage 5 1 Command Line Options 5 1 1 Custom Header h The header the code generator inserts in the generated source files can be customized using the hfilename commandline option E g java jar Idxg jar w tutorial choice cconf cfg xml s3 hcustom txt kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk FAFEFEEAFHEAFEEFEFEFEFEFEFEFEFEEEFEFAFEFEFEFEFEFEFEFEFEFEFEEEEEEEEE A A A A A A CUSTOM HEADER CUSTOM HEADER CUSTOM HEADER CUSTOM HEADER CUSTOM HEADER CUSTOM HEADER CUSTOM HEADER CUSTOM HEADER CUSTOM HEADER CUSTOM HEADER ARA A A A A HHHH HHHH HHHH HHHH A HH A A A A A A A A A A A A A A A This code was generated using ldxg v 2 2 0 Generated code is compatible with ldx framework v 2 2 License Dijkstra ICT Consulting Module CHOICE Generation date Sat Feb 14 12 12 04 CET 2015 kkkkk kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk In the example above the file custom txt contains the following E ia aia aa sba sia sda A A sda sba la la aa ba aba sla aa d sba A A ala sa PEPE PE TH CUSTOM HEADER CUSTOM HEADER CUSTOM HEADER CUSTOM HEADER CUSTOM HEADER CUSTOM HEADER CUSTOM HEADER CUSTOM HEADER CUSTOM HEADER CUSTOM HEADER E i aia aa mba si sla sa mia sba sba ia aia aa ba ia ala ba A sba sda sl ba sla aa la ba sda aa A aba sa E
15. odule name ext input path tutorial ext schema putput path tutorial ext sro gt El Within a module multiple interfaces may exist Each interface corresponds to an XML Schema file For each X5D the root type to be handled and the name of the handler class are specified gt lt interface name ext xsd message handler root ProductContainer message handler name ExtMessageHandler message handler processor ExtProcessor messaqge handler application ExtApplication gt lt module gt lt domain gt lt 1ldx generator gt Figure 1 Generator Configuration To detect errors made during editing the parser checks the configuration file against the configuration XSD conf ldxg xsq The domain indicates the business domain to which your project belongs Domain attribute name is appended to the Java package name whose base is com ldx by default and applies for all contained elements The base package com ldx can be changed by using the base attribute Using the instructions shown in figure 1 the generator generates com xyz Per configuration file the generator supports only one domain To generate code for multiple domains use multiple configuration files Both domain base and domain name are optional if name is not present the package is the base package in this case com xyz The module indicates the sub domain within the domain The package in which the classes are generated is given by the Java package n
16. or the root type An alternative often used is a different module for each interface schema The module s name is then used to create the fully qualified name of the class Dijkstra ICT Consulting LDX Generator User Manual v 2 2 Pg 9 14 Dijkstra ICT Consulting LDX Generator User Manual v 2 2 6 Example In this section we illustrate different runtime configurations by examining the subst example You can find this example in the tutorials subdirectory 6 1 The subst XML schema lt xsd complexType name AContainedType gt lt xsd sequence gt lt xsd element name name type xsd string gt lt xsd sequerce gt lt fxsd complexType gt lt xsd complexType name AType gt lt xsd Sequence gt lt xsd element name Tirst type xsd string gt lt xsd element name containedA type AContainedType gt lt xsd sequernce gt lt xsd complexType gt lt xsd complexType nome BType gt lt xsd complexContent gt lt xsd extension base AType gt lt xSd Sequence gt lt xsd element name second type xsd string gt lt xsd sSequernce gt lt xsd extensLon gt lt xsd complexContent gt lt xsd complexType gt lt xsd complexType nome CType gt lt xsd complexContent gt lt xsd extension base BType gt lt xsd Sequence gt lt xsd element name third type xsd string gt lt xs5d sequence gt lt xsd extensLon gt xsd complexContent gt lt xsd complexType gt The
17. upport for modular XML Schemata include anonymous complexTypes subsitution and referencing grouping also cardinality of grouping multiplicity of sequence choices or groups are propagated downwards references LDX 2 1 further adds automatic generation of stubs for the processor component as well as the application Currently not supported XML anyType union list import within schemata targetNamespace other than the default Dijkstra ICT Consulting LDX Generator User Manual v 2 2 Pg 14 14
18. which you unpacked the zip file you will see the following directory structure bin LDX Generator essentials These files are read only and should not be altered They are used by the generator to generate the code conf Contains the specification of the generator configuration XSD This file is used by the generator to detect errors in the configuration file doc The documentation for the LDX Generator docs Reference documentation HTML samples Set of samples iso20022 illustrating the code generator tutorial A set of examples illustrating the capabilities features of the LDX Generator Idxg jar The generator binary The Tutorial directory contains a set of examples designed to illustrate how the code generator maps XML onto Java Each subdirectory follows the same structure illustrated by the choice example ES choice la conf generate la input A prop gt schema choice xsd a src conf The configuration for the LDX Generator docs The optionally generated Java reference documentation input Sample input files XML prop Property file s for this example used by the example program schema The XML Schema which is both used for validation and by the generator src The generated source code In some of the examples an ANT build file is provided within the respective sub directory We provided a generate batch file that generates all the sources directly under Tutorial in a src sub directory Dijkstra ICT Consulti

Download Pdf Manuals

image

Related Search

Related Contents

取扱説明書の表示  ION Audio Center Stage  Snell SR30THX Speaker  1 English 26 Français 51 Deutsch 77 Italiano 102 Español    LN-9521-00.2 Aerobell 33 Rotary Atomizer 3-05.pmd  3M MP180  GP-M231 GP-M201  Samsung DDR3 8GB, PC-1333  D F I E - Makita gereedschap online kopen? Mtools.nl  

Copyright © All rights reserved.
Failed to retrieve file