AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Ayuda / WLanguage / Administrar bases de datos / HFSQL / Funciones HFSQL
  • Type of import
  • Array items
  • Format of expected XML
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Imports an XML file into an HFSQL Classic or Client/Server data file. This data file must have been defined in the data model editor, or declared with <Source>.Declare, <Source>.DeclareExternal or <Source>.DescribeFile).
Ejemplo
WINDEV
// Import "C:\MyFiles\Customer.xml" into Customer data file. 
// The Customer data file will be overwritten if it already exists (hImpCreation constant)
// A progress bar will be displayed in PROGBAR_ProgBar1
Customer.ImportXML("C:\MyFiles\Customer.xml", hImpCreation, PROGBAR_ProgBar1)
Sintaxis
<Result> = <Source>.ImportXML([<Path of the XML file> , <Destination items> [, <XML attributes to import>]] [, <Options> [, <Progress Bar> [, <Root node>]]])
<Result>: Booleano
  • True if the operation was performed,
  • False if an error occurs. HError is used to identify the problem.
<Source>: Tipo de fuente especificada
Name of the HFSQL data file to import into.
<Path of the XML file>: Cadena de caracteres opcional
Full access path to XML file to import.
<Destination items>: Cadena de caracteres opcional
List of names of items in the data file into which the import will be performed. Names can be delimited by single quotes and are separated by commas or CR characters. The names of the composite key items, binary memo items and binary items are ignored.
The non-imported items will be initialized with their default value described in the analysis.
If this parameter is not specified or if it is an empty string, all the items are imported (except the composite keys, the binary items and the binary memos) in the physical order of description.
<XML attributes to import>: Cadena de caracteres opcional
List of names of items found in the XML file to import.
If this parameter is not specified or if it corresponds to an empty string, all the nodes of XML files are imported.
<Options>: Constante o combinación de constantes de tipo Integer (opcional)
Configures the type of import to perform:
hImpBreakableThe import can be interrupted by pressing the Esc key on the keyboard.
If the import is interrupted, the imported records are kept in the data file.
hImpCreationIf the data file to import into exists, it will be overwritten.
hImpNormal
(default value)
If the import data file already exists, it is populated with the imported data; otherwise, the data file is created.
<Progress Bar>: Nombre de control o ventana opcional
  • Name of the window in which the progress bar will be displayed
  • Name of the Progress Bar control.
WEBDEV - Código Servidor This parameter is not available.
<Root node>: Cadena de caracteres opcional
Node of XML file from which the import will be performed. Used to import a section of XML file into the HFSQL data file. The type of this parameter is "root/clients".
Observaciones
WINDEVWEBDEV - Código ServidorAjaxHFSQL ClassicHFSQL Client/ServerProcedimientos almacenados

Type of import

If the list of XML attributes is specified: the import will search for XML nodes with the same name as the fields.
Example: The data file described in the analysis contains the following fields RUB1, RUB2; ... The XML file should therefore be structured as follows:
<FILE>
<ITEM1>Data1</ITEM1>
<ITEM2>Data2</ITEM2>
...
</FILE>
<FILE>
...
The names of nodes found in the XML file that do not exist in the analysis or that are not specified in the list of items will be ignored during the import.
If the list of XML attributes is not specified, the value of the XML nodes is included in the item of the HFSQL data file that is named like the XML attribute.
Example The data file described in the analysis contains the following items: NODE1, NODE2, NODE3.
The XML file has the following type of structure and the list of specified items is "NODE2+NODE1":
<ELEMENT1>
<NODE1>Data1</NODE1>
<NODE2>Data2</NODE2>
<NODE3>Data3</NODE3>
...
</ELEMENT1>
<ELEMENT2>...
'Data1' will be assigned to 'NODE2',
'Data2' will be assigned to 'NODE1'
'Data3' will be ignored because the list of items " NODE2+NODE1 " contains 2 items only.

Array items

<Source>.ImportXML can also be used to import array items.
To do so, the array elements must be included in the child tags.
Example The data file described in the analysis contains the following fields: RUB1, RUB2, RUBTABLE. The ARRAYITEM item is an array item.
The list of items is "ITEM1+ITEM2+ARRAYITEM" and the XML file has the following structure:
<FILE>
<ITEM1>Data1</ITEM1>
<ITEM2>Data2</ITEM2>
<ARRITEM>
<!-- child tags -->
<ARRAYITEM_1>ArrayData1</ARRAYITEM_1>
<ARRAYITEM_2>ArrayData2</ARRAYITEM_2>
</ARRITEM>
</FILE>
...
'Data1' will be assigned to 'ITEM1',
'Data2' will be assigned to 'ITEM2',
'ArrayData1' will be assigned to 'ARRAYITEM[1]',
'ArrayData2' will be assigned to ARRAYITEM[2]'.

Format of expected XML

<Source>.ImportXML expects an XML file with a specific structure.
Example:
<racine><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
<record>
<item1>val</item1>
<item2>val</item2>
</record>
<record>
<item1>val</item1>
<item2>val</item2>
</record>
</root>
This format is also used by <Source>.ExportXML.
If your XML file does not use this structure, the import will not be performed properly. You may get one record per item for example.
Clasificación Lógica de negocio / UI: Lógica de negocio
Componente: wd300hf.dll
Versión mínima requerida
  • Versión 25
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 22/11/2024

Señalar un error o enviar una sugerencia | Ayuda local