Ayuda sobre productos BOLD:
Comando sincro GetBOLDXML
Se utiliza para transformar un fichero de XML en otro aplicando un lenguaje similar al XSLT.
Sintaxis
sincro GetBOLDXML <transformacion> <xml_input> <xml_output>
También es posible invocarlos directamente con
GetBOLDXML <transformacion> <xml_input> <xml_output>
Ejemplos de transformaciones complejas
Se pueden encontrar dentro de una instalación BOLDXML2 en las carpetas de las integraciones standard existentes: BOLDXML2\a3 y BOLDXML2\sapics.
Ver también Documento de definición de una transformación XML.
Ejemplo
El siguiente ejemplo carga la lista de países del mundo como un campo enum TEnumCountries sobre una tabla secundaria.
Fichero de transformación
<?xml version="1.0"?> <IntContainerVector> <UpdateFields UpdateOnly="0" COLNAME0="Name" COLNAME1="IValue" COLNAME2="Description"/> {% for o in list %} <EnumDB> <EnumTypeID value="TEnumCountry" /> <Name value="{{ o.$['country-code'] }}"/> <Description value="{{ o.$.name }}"/> </EnumDB> {% endfor %} </IntContainerVector>
Para acceder al valor de nodo dentro del nodo <Record> basta con poner el nombre del nodo hijo. Para acceder a los atributos de cada nodo <Record> del fichero XML de entrada se debe anteponer un .$
Especialización de plantillas estándard
El fichero de transformación se deberá dejar donde indique la variable de configuración de BOLDXML.json (ver Ficheros de configuración de BOLDXML2). De forma estándard apunta a la siguiente carpeta:
"XSLT" : "C:/Program Files (x86)/Global Planning Solutions/BOLDXML2/a3/",
Si lo único que se quiere es especializar alguna plantilla, basta con copiar la plantilla estándard en la carpeta (ejemplo)
C:\Program Files (x86)\Global Planning Solutions\Custom_Files\Integration\configuration\development\xslt
y luego modificarla desde allí.
Ejecución de la transformación
Para ejecutar la transformación, en la linea de comandos de BOLDXML2 escribir:
GetBOLDXML Countries Country_codes_ISO_3166 Countries
Deben existir los ficheros transformación, input (en las carpetas que se hayan configurado):
- C:\Proyectos\Clientes\cliente1\Integration\xslt\
- C:\ImportExport\cliente1\NativeXML\Country_codes_ISO_3166.xml
El resultado debería aparecer en: C:\ImportExport\cliente1\BOLDXML\countries.xml
Fichero de entrada
El fichero de entrada xML utilizado es el siguiente (dejarlo en la carpeta configurada como NativeXML. Notar que para que el fichero sea leído correctamente, es necesario que la lista de entidades nativas a transformar estén dentro de un nodo <QueryResult> y los datos de cada entidad dentro de un nodo <Record>.
<?xml version="1.0" encoding="UTF-8"?> <QueryResult> <Record name="Afghanistan" alpha-3="AFG" country-code="004"/> <Record name="Åland Islands" alpha-3="ALA" country-code="248"/> <Record name="Albania" alpha-3="ALB" country-code="008"/> <Record name="Algeria" alpha-3="DZA" country-code="012"/> <Record name="American Samoa" alpha-3="ASM" country-code="016"/> <Record name="Andorra" alpha-3="AND" country-code="020"/> <Record name="Angola" alpha-3="AGO" country-code="024"/> <Record name="Anguilla" alpha-3="AIA" country-code="660"/> <Record name="Antarctica" alpha-3="ATA" country-code="010"/> <Record name="Antigua and Barbuda" alpha-3="ATG" country-code="028"/> <Record name="Argentina" alpha-3="ARG" country-code="032"/> <Record name="Armenia" alpha-3="ARM" country-code="051"/> <Record name="Aruba" alpha-3="ABW" country-code="533"/> <Record name="Australia" alpha-3="AUS" country-code="036"/> <Record name="Austria" alpha-3="AUT" country-code="040"/> <Record name="Azerbaijan" alpha-3="AZE" country-code="031"/> <Record name="Bahamas" alpha-3="BHS" country-code="044"/> <Record name="Bahrain" alpha-3="BHR" country-code="048"/> <Record name="Bangladesh" alpha-3="BGD" country-code="050"/> <Record name="Barbados" alpha-3="BRB" country-code="052"/> <Record name="Belarus" alpha-3="BLR" country-code="112"/> <Record name="Belgium" alpha-3="BEL" country-code="056"/> <Record name="Belize" alpha-3="BLZ" country-code="084"/> <Record name="Benin" alpha-3="BEN" country-code="204"/> <Record name="Bermuda" alpha-3="BMU" country-code="060"/> <Record name="Bhutan" alpha-3="BTN" country-code="064"/> <Record name="Bolivia (Plurinational State of)" alpha-3="BOL" country-code="068"/> <Record name="Bonaire, Sint Eustatius and Saba" alpha-3="BES" country-code="535"/> <Record name="Bosnia and Herzegovina" alpha-3="BIH" country-code="070"/> <Record name="Botswana" alpha-3="BWA" country-code="072"/> <Record name="Bouvet Island" alpha-3="BVT" country-code="074"/> <Record name="Brazil" alpha-3="BRA" country-code="076"/> <Record name="British Indian Ocean Territory" alpha-3="IOT" country-code="086"/> <Record name="Brunei Darussalam" alpha-3="BRN" country-code="096"/> <Record name="Bulgaria" alpha-3="BGR" country-code="100"/> <Record name="Burkina Faso" alpha-3="BFA" country-code="854"/> <Record name="Burundi" alpha-3="BDI" country-code="108"/> <Record name="Cambodia" alpha-3="KHM" country-code="116"/> <Record name="Cameroon" alpha-3="CMR" country-code="120"/> <Record name="Canada" alpha-3="CAN" country-code="124"/> <Record name="Cabo Verde" alpha-3="CPV" country-code="132"/> <Record name="Cayman Islands" alpha-3="CYM" country-code="136"/> <Record name="Central African Republic" alpha-3="CAF" country-code="140"/> <Record name="Chad" alpha-3="TCD" country-code="148"/> <Record name="Chile" alpha-3="CHL" country-code="152"/> <Record name="China" alpha-3="CHN" country-code="156"/> <Record name="Christmas Island" alpha-3="CXR" country-code="162"/> <Record name="Cocos (Keeling) Islands" alpha-3="CCK" country-code="166"/> <Record name="Colombia" alpha-3="COL" country-code="170"/> <Record name="Comoros" alpha-3="COM" country-code="174"/> <Record name="Congo" alpha-3="COG" country-code="178"/> <Record name="Congo (Democratic Republic of the)" alpha-3="COD" country-code="180"/> <Record name="Cook Islands" alpha-3="COK" country-code="184"/> <Record name="Costa Rica" alpha-3="CRI" country-code="188"/> <Record name="Côte d'Ivoire" alpha-3="CIV" country-code="384"/> <Record name="Croatia" alpha-3="HRV" country-code="191"/> <Record name="Cuba" alpha-3="CUB" country-code="192"/> <Record name="Curaçao" alpha-3="CUW" country-code="531"/> <Record name="Cyprus" alpha-3="CYP" country-code="196"/> <Record name="Czech Republic" alpha-3="CZE" country-code="203"/> <Record name="Denmark" alpha-3="DNK" country-code="208"/> <Record name="Djibouti" alpha-3="DJI" country-code="262"/> <Record name="Dominica" alpha-3="DMA" country-code="212"/> <Record name="Dominican Republic" alpha-3="DOM" country-code="214"/> <Record name="Ecuador" alpha-3="ECU" country-code="218"/> <Record name="Egypt" alpha-3="EGY" country-code="818"/> <Record name="El Salvador" alpha-3="SLV" country-code="222"/> <Record name="Equatorial Guinea" alpha-3="GNQ" country-code="226"/> <Record name="Eritrea" alpha-3="ERI" country-code="232"/> <Record name="Estonia" alpha-3="EST" country-code="233"/> <Record name="Ethiopia" alpha-3="ETH" country-code="231"/> <Record name="Falkland Islands (Malvinas)" alpha-3="FLK" country-code="238"/> <Record name="Faroe Islands" alpha-3="FRO" country-code="234"/> <Record name="Fiji" alpha-3="FJI" country-code="242"/> <Record name="Finland" alpha-3="FIN" country-code="246"/> <Record name="France" alpha-3="FRA" country-code="250"/> <Record name="French Guiana" alpha-3="GUF" country-code="254"/> <Record name="French Polynesia" alpha-3="PYF" country-code="258"/> <Record name="French Southern Territories" alpha-3="ATF" country-code="260"/> <Record name="Gabon" alpha-3="GAB" country-code="266"/> <Record name="Gambia" alpha-3="GMB" country-code="270"/> <Record name="Georgia" alpha-3="GEO" country-code="268"/> <Record name="Germany" alpha-3="DEU" country-code="276"/> <Record name="Ghana" alpha-3="GHA" country-code="288"/> <Record name="Gibraltar" alpha-3="GIB" country-code="292"/> <Record name="Greece" alpha-3="GRC" country-code="300"/> <Record name="Greenland" alpha-3="GRL" country-code="304"/> <Record name="Grenada" alpha-3="GRD" country-code="308"/> <Record name="Guadeloupe" alpha-3="GLP" country-code="312"/> <Record name="Guam" alpha-3="GUM" country-code="316"/> <Record name="Guatemala" alpha-3="GTM" country-code="320"/> <Record name="Guernsey" alpha-3="GGY" country-code="831"/> <Record name="Guinea" alpha-3="GIN" country-code="324"/> <Record name="Guinea-Bissau" alpha-3="GNB" country-code="624"/> <Record name="Guyana" alpha-3="GUY" country-code="328"/> <Record name="Haiti" alpha-3="HTI" country-code="332"/> <Record name="Heard Island and McDonald Islands" alpha-3="HMD" country-code="334"/> <Record name="Holy See" alpha-3="VAT" country-code="336"/> <Record name="Honduras" alpha-3="HND" country-code="340"/> <Record name="Hong Kong" alpha-3="HKG" country-code="344"/> <Record name="Hungary" alpha-3="HUN" country-code="348"/> <Record name="Iceland" alpha-3="ISL" country-code="352"/> <Record name="India" alpha-3="IND" country-code="356"/> <Record name="Indonesia" alpha-3="IDN" country-code="360"/> <Record name="Iran (Islamic Republic of)" alpha-3="IRN" country-code="364"/> <Record name="Iraq" alpha-3="IRQ" country-code="368"/> <Record name="Ireland" alpha-3="IRL" country-code="372"/> <Record name="Isle of Man" alpha-3="IMN" country-code="833"/> <Record name="Israel" alpha-3="ISR" country-code="376"/> <Record name="Italy" alpha-3="ITA" country-code="380"/> <Record name="Jamaica" alpha-3="JAM" country-code="388"/> <Record name="Japan" alpha-3="JPN" country-code="392"/> <Record name="Jersey" alpha-3="JEY" country-code="832"/> <Record name="Jordan" alpha-3="JOR" country-code="400"/> <Record name="Kazakhstan" alpha-3="KAZ" country-code="398"/> <Record name="Kenya" alpha-3="KEN" country-code="404"/> <Record name="Kiribati" alpha-3="KIR" country-code="296"/> <Record name="Korea (Democratic People's Republic of)" alpha-3="PRK" country-code="408"/> <Record name="Korea (Republic of)" alpha-3="KOR" country-code="410"/> <Record name="Kuwait" alpha-3="KWT" country-code="414"/> <Record name="Kyrgyzstan" alpha-3="KGZ" country-code="417"/> <Record name="Lao People's Democratic Republic" alpha-3="LAO" country-code="418"/> <Record name="Latvia" alpha-3="LVA" country-code="428"/> <Record name="Lebanon" alpha-3="LBN" country-code="422"/> <Record name="Lesotho" alpha-3="LSO" country-code="426"/> <Record name="Liberia" alpha-3="LBR" country-code="430"/> <Record name="Libya" alpha-3="LBY" country-code="434"/> <Record name="Liechtenstein" alpha-3="LIE" country-code="438"/> <Record name="Lithuania" alpha-3="LTU" country-code="440"/> <Record name="Luxembourg" alpha-3="LUX" country-code="442"/> <Record name="Macao" alpha-3="MAC" country-code="446"/> <Record name="Macedonia (the former Yugoslav Republic of)" alpha-3="MKD" country-code="807"/> <Record name="Madagascar" alpha-3="MDG" country-code="450"/> <Record name="Malawi" alpha-3="MWI" country-code="454"/> <Record name="Malaysia" alpha-3="MYS" country-code="458"/> <Record name="Maldives" alpha-3="MDV" country-code="462"/> <Record name="Mali" alpha-3="MLI" country-code="466"/> <Record name="Malta" alpha-3="MLT" country-code="470"/> <Record name="Marshall Islands" alpha-3="MHL" country-code="584"/> <Record name="Martinique" alpha-3="MTQ" country-code="474"/> <Record name="Mauritania" alpha-3="MRT" country-code="478"/> <Record name="Mauritius" alpha-3="MUS" country-code="480"/> <Record name="Mayotte" alpha-3="MYT" country-code="175"/> <Record name="Mexico" alpha-3="MEX" country-code="484"/> <Record name="Micronesia (Federated States of)" alpha-3="FSM" country-code="583"/> <Record name="Moldova (Republic of)" alpha-3="MDA" country-code="498"/> <Record name="Monaco" alpha-3="MCO" country-code="492"/> <Record name="Mongolia" alpha-3="MNG" country-code="496"/> <Record name="Montenegro" alpha-3="MNE" country-code="499"/> <Record name="Montserrat" alpha-3="MSR" country-code="500"/> <Record name="Morocco" alpha-3="MAR" country-code="504"/> <Record name="Mozambique" alpha-3="MOZ" country-code="508"/> <Record name="Myanmar" alpha-3="MMR" country-code="104"/> <Record name="Namibia" alpha-3="NAM" country-code="516"/> <Record name="Nauru" alpha-3="NRU" country-code="520"/> <Record name="Nepal" alpha-3="NPL" country-code="524"/> <Record name="Netherlands" alpha-3="NLD" country-code="528"/> <Record name="New Caledonia" alpha-3="NCL" country-code="540"/> <Record name="New Zealand" alpha-3="NZL" country-code="554"/> <Record name="Nicaragua" alpha-3="NIC" country-code="558"/> <Record name="Niger" alpha-3="NER" country-code="562"/> <Record name="Nigeria" alpha-3="NGA" country-code="566"/> <Record name="Niue" alpha-3="NIU" country-code="570"/> <Record name="Norfolk Island" alpha-3="NFK" country-code="574"/> <Record name="Northern Mariana Islands" alpha-3="MNP" country-code="580"/> <Record name="Norway" alpha-3="NOR" country-code="578"/> <Record name="Oman" alpha-3="OMN" country-code="512"/> <Record name="Pakistan" alpha-3="PAK" country-code="586"/> <Record name="Palau" alpha-3="PLW" country-code="585"/> <Record name="Palestine, State of" alpha-3="PSE" country-code="275"/> <Record name="Panama" alpha-3="PAN" country-code="591"/> <Record name="Papua New Guinea" alpha-3="PNG" country-code="598"/> <Record name="Paraguay" alpha-3="PRY" country-code="600"/> <Record name="Peru" alpha-3="PER" country-code="604"/> <Record name="Philippines" alpha-3="PHL" country-code="608"/> <Record name="Pitcairn" alpha-3="PCN" country-code="612"/> <Record name="Poland" alpha-3="POL" country-code="616"/> <Record name="Portugal" alpha-3="PRT" country-code="620"/> <Record name="Puerto Rico" alpha-3="PRI" country-code="630"/> <Record name="Qatar" alpha-3="QAT" country-code="634"/> <Record name="Réunion" alpha-3="REU" country-code="638"/> <Record name="Romania" alpha-3="ROU" country-code="642"/> <Record name="Russian Federation" alpha-3="RUS" country-code="643"/> <Record name="Rwanda" alpha-3="RWA" country-code="646"/> <Record name="Saint Barthélemy" alpha-3="BLM" country-code="652"/> <Record name="Saint Helena, Ascension and Tristan da Cunha" alpha-3="SHN" country-code="654"/> <Record name="Saint Kitts and Nevis" alpha-3="KNA" country-code="659"/> <Record name="Saint Lucia" alpha-3="LCA" country-code="662"/> <Record name="Saint Martin (French part)" alpha-3="MAF" country-code="663"/> <Record name="Saint Pierre and Miquelon" alpha-3="SPM" country-code="666"/> <Record name="Saint Vincent and the Grenadines" alpha-3="VCT" country-code="670"/> <Record name="Samoa" alpha-3="WSM" country-code="882"/> <Record name="San Marino" alpha-3="SMR" country-code="674"/> <Record name="Sao Tome and Principe" alpha-3="STP" country-code="678"/> <Record name="Saudi Arabia" alpha-3="SAU" country-code="682"/> <Record name="Senegal" alpha-3="SEN" country-code="686"/> <Record name="Serbia" alpha-3="SRB" country-code="688"/> <Record name="Seychelles" alpha-3="SYC" country-code="690"/> <Record name="Sierra Leone" alpha-3="SLE" country-code="694"/> <Record name="Singapore" alpha-3="SGP" country-code="702"/> <Record name="Sint Maarten (Dutch part)" alpha-3="SXM" country-code="534"/> <Record name="Slovakia" alpha-3="SVK" country-code="703"/> <Record name="Slovenia" alpha-3="SVN" country-code="705"/> <Record name="Solomon Islands" alpha-3="SLB" country-code="090"/> <Record name="Somalia" alpha-3="SOM" country-code="706"/> <Record name="South Africa" alpha-3="ZAF" country-code="710"/> <Record name="South Georgia and the South Sandwich Islands" alpha-3="SGS" country-code="239"/> <Record name="South Sudan" alpha-3="SSD" country-code="728"/> <Record name="Spain" alpha-3="ESP" country-code="724"/> <Record name="Sri Lanka" alpha-3="LKA" country-code="144"/> <Record name="Sudan" alpha-3="SDN" country-code="729"/> <Record name="Suriname" alpha-3="SUR" country-code="740"/> <Record name="Svalbard and Jan Mayen" alpha-3="SJM" country-code="744"/> <Record name="Swaziland" alpha-3="SWZ" country-code="748"/> <Record name="Sweden" alpha-3="SWE" country-code="752"/> <Record name="Switzerland" alpha-3="CHE" country-code="756"/> <Record name="Syrian Arab Republic" alpha-3="SYR" country-code="760"/> <Record name="Taiwan, Province of China" alpha-3="TWN" country-code="158"/> <Record name="Tajikistan" alpha-3="TJK" country-code="762"/> <Record name="Tanzania, United Republic of" alpha-3="TZA" country-code="834"/> <Record name="Thailand" alpha-3="THA" country-code="764"/> <Record name="Timor-Leste" alpha-3="TLS" country-code="626"/> <Record name="Togo" alpha-3="TGO" country-code="768"/> <Record name="Tokelau" alpha-3="TKL" country-code="772"/> <Record name="Tonga" alpha-3="TON" country-code="776"/> <Record name="Trinidad and Tobago" alpha-3="TTO" country-code="780"/> <Record name="Tunisia" alpha-3="TUN" country-code="788"/> <Record name="Turkey" alpha-3="TUR" country-code="792"/> <Record name="Turkmenistan" alpha-3="TKM" country-code="795"/> <Record name="Turks and Caicos Islands" alpha-3="TCA" country-code="796"/> <Record name="Tuvalu" alpha-3="TUV" country-code="798"/> <Record name="Uganda" alpha-3="UGA" country-code="800"/> <Record name="Ukraine" alpha-3="UKR" country-code="804"/> <Record name="United Arab Emirates" alpha-3="ARE" country-code="784"/> <Record name="United Kingdom of Great Britain and Northern Ireland" alpha-3="GBR" country-code="826"/> <Record name="United States of America" alpha-3="USA" country-code="840"/> <Record name="United States Minor Outlying Islands" alpha-3="UMI" country-code="581"/> <Record name="Uruguay" alpha-3="URY" country-code="858"/> <Record name="Uzbekistan" alpha-3="UZB" country-code="860"/> <Record name="Vanuatu" alpha-3="VUT" country-code="548"/> <Record name="Venezuela (Bolivarian Republic of)" alpha-3="VEN" country-code="862"/> <Record name="Viet Nam" alpha-3="VNM" country-code="704"/> <Record name="Virgin Islands (British)" alpha-3="VGB" country-code="092"/> <Record name="Virgin Islands (U.S.)" alpha-3="VIR" country-code="850"/> <Record name="Wallis and Futuna" alpha-3="WLF" country-code="876"/> <Record name="Western Sahara" alpha-3="ESH" country-code="732"/> <Record name="Yemen" alpha-3="YEM" country-code="887"/> <Record name="Zambia" alpha-3="ZMB" country-code="894"/> <Record name="Zimbabwe" alpha-3="ZWE" country-code="716"/> </QueryResult>