05. Producir un archivo xml en AGRIS AP

WebAGRIS is used by many AGRIS centres as a database management system. WEBAGRIS has adapted the AGRIS AP standard both at the data description level as well as the export level, producing valid AGRIS AP XML records that can be exchanged easily amongst data and service providers.

Most of the centres are already sending their input using this format.

The following guidelines explain how this feature is implemented in the WEBAGRIS application.

 

Understanding the process



The preparation of an AGRIS AP XML file from an existing WebAGRIS database is based on the print formats and is done according to the guidelines found in the AGRIS User Guide AGRIS AP User Guide.



This functionality is already incorporated into the new WebAGRIS system. Below is a brief description of the structure of an exported XML file.



An Export XML file has the following three components:


HEADERcontains declarations of XML and namespace
MAIN BODYcontains records with unique ARNs

[Record1 in XML]

[Record2 in XML]

[Record3 in XML]

.....

 
FOOTERcontains the closing tags



 

Main body

After analysis of the required fields (elements), and the creation of mapping tables between the WebAGRIS application and AGRIS AP, a CDS-ISIS print format was created and used as a reformatting tool. It is applied iteratively to represent each record in the XML output. A header and footer must be added to the final XML file to make it valid.

The header and footer

The header must contain a reference to the AGRIS AP XML DTD. Users permanently connected to the Internet refer to it within the XML record, using the following URL: http://purl.org/agmes/agrisap/dtd/. The header should look like this:







 

Users not permanently connected to the Internet, should refer to a local AGRIS AP XML DTD saved in the local directory where the xml file is created. The header in this case will look like:







The header and footer are automatically added by WebAGRIS using the hdrdxml.pft and ftrxml.pft files; however, please ensure that the AGRIS AP XML DTD used is the current version downloadable from AGRIS DTD.

The proposed header format is for Latin-1 character set which covers all latin characters (English, French, Spanish, Italian, etc). This is reflected in the parameter: encoding="ISO-8859-1".

The print format file, hdrxml.pft, can be found under the agris database directory (for example: \xitami\webpages\DB\agris) and should be changed if you are not using only Latin-1 character set.

You have to identify which encoding is used for your national character set. It should include Latin (not accented characters) plus national characters.

Here below are some samples for encoding values for different character set:

  • For Bulgarian the parameter should be: encoding="windows-1251" ,
  • For Polish should be: encoding="ISO-8859-2",
  • For Korean should be: encoding="EUC-KR"

Wrong encoding cannot be changed in the xml file.

The exported xml file in this WEBAGRIS version 2.0 is saved with an extension .xxx (agris.xxx). This choice has been done in order to allow the system to prompt the user and not to automatically open the file with the software assigned to the xml extension. This was also done for resolving encoding parameter problem that may occurs.

The file could be further opened, saved and/or exported to the central database. In order to be validated it should be renamed as .xml and then opened with a browser.

If the records are sent without validating against the latest version, the file will be returned for correction and will not be incorporated into the central AGRIS Database.



 

For any questions please do not hesitate to contact us at: AGRIS Secretariat



Go to:The WebAGRIS download page