« Back

Exported XML file format

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Exported XML file format
community documentation transformation core
Answer
3/27/14 12:09 PM
Is there any possibility to add an "id" on the element "ATTRIBUTE" when you export models as an XML file? Such us:

<ATTRIBUTE 
id="nombre" name="Nombre" type="STRING"></ATTRIBUTE>
<ATTRIBUTE id="esDeEmergencia" name="Es de Emergencia" type="INTEGER">0</ATTRIBUTE>

RE: Exported XML file format
xml xsl
Answer
1/8/14 7:41 AM as a reply to Anonymous.
There is no standard functionality for adding another attribute to the tags in the file resulting after the XML export.
You could, however, create your own XSL file and call an external XSL transformation engine (provided with ADOxx) after successfully exporting your model(s). Please let me know if this could be an option for you and I'll be glad to assist you with creating the XSL file and/or creating the AdoScript for calling the XSL transformation.

RE: Exported XML file format
Answer
1/8/14 9:54 AM as a reply to Anonymous.
I might extend on Sabin's answer a bit with respect to modifying the XML output and enhancing the exported information as suggested in the initial post. Using XSL as suggested for transformation would be one approach to transform to a different format using the given information in the initial XML provided through the export.

In case the exported information is insufficient (as in the example snipplet) and needs extension, this can be done by modifying and adapting the AdoScript files producing the XML in ADOxx. As part of the platform distribution you can find the AdoScript files responsible for importing and exporting XML information through the user interface ("Import/Export" component -> "Model" -> "XML Import (default)" or "XML Export (default)") in the installation directory of ADOxx (should be %PROGRAM FILES%\BOC\ADOxx13_EN_SA.

The following files are available in the directory to triggered during the XML export:
  • xmlexp3012.asc
  • xmlexp3012_procs.asc
The following files are available in the directory to trigger the XML import:
  • xmlimp3012.asc
  • xmlimp3012_globals_meta.asc
  • xmlimp3012_preprocs.asc
  • xmlimp3012_procs.asc
  • xmlimp3013.asc
  • xmlimpexp3012_globals_de.asc
  • xmlimpexp3012_globals_en.asc
  • xmlimpexp3012_globals_meta.asc
In order to have the modification as described in the question, we can modify the procedure XMLEXP_PRINTATTRIBUTEin xmlexp3012_procs.asc which is responsible for writing attributes to the output. The modification to add attribute IDs relates to adding the following statement for the different types RECORD, INTERREF, and all other ATTRIBUTES.

 1CC "Documentation" XML_WRITEATTRIBUTE "id" value: (STR n_attrid)
 2#--> RESULT ecode:intValue
 3SETL n_ecode: (ecode)
 4
 5IF (n_ecode != 0) {
 6  CC "AdoScript" ERRORBOX ("[axmlexp-24.1]\n" +
 7                               c_g_str_xml_xml_writeattribute_1 + "id" +
 8                               c_g_str_xml_xml_writeattribute_2 + str_attrtype +
 9                               c_g_str_xml_xml_writeattribute_3 +
10                               c_g_str_xml_error + STR n_ecode)
11  #-->  RESULT endbutton:strValue
12  SETL b_thisxmlexp_aborted:1
13  EXIT
14}

Please find attached the updated AdoScript - in order to install the update, download the file and overwrite the AdoScript in the installation directory. After a restart the export is enhanced with attribute IDs.
Attachments: xmlexp3012_procs.asc (123.3k)