The OFBiz WebTools interface provides a number of utilities to help load data, from one or more files and/or directories, into any Entity Engine data source (including databases). In this section, we shall examine loading data from XML document files using the WebTools Entity XML Tools.
Make sure the data to be loaded is formatted correctly as the OFBiz XML Data Import tool requires files to be in XML document format beginning with an entity-engine-xml
element tag and ending with the appropriate closing tag as shown:
<entity-engine-xml> <!-- This is a comment and is valid within a data file --> <EntityName fieldName="someValue" anotherFieldName="someOtherValue" /> <!-- You may have as many entity/field declarations as desired within a single file --> </entity-engine-xml>
Each XML element within the XML data file represents a record (or row) to be inserted into the indicated entity. Within an element's declaration, each attribute represents a column (or field) within the entity. Attribute names must be valid entity field names. There are many examples of this formatting throughout the code base as this is the format used to construct seed and other data loaded automatically by the ANT data loading directives.
To get started and use the XML Data Import tool, either navigate to the WebTools main web page and select XML Data Import from the main web page menu, or go directly to the tool's URL located at https://localhost:8443/webtools/control/EntityImport. If you have not already logged in, you will be prompted to log in. Enter the administrator's username and password. If these have not changed since initial system download, the administrative user's name is "admin" and the password is "ofbiz".
A database can be loaded from an XML document by following these steps:
TEXTAREA
. Click the Import Text button as shown:The XML Data Import tool takes one or more well-formed XML document file(s) and copies data from each file as instructed by the XML declarations within the file. Each XML file must contain one or more element(s) that declares the entity to be loaded, as well as element attributes that define the entity fields and the data values to load.
When loading files using the XML Data Import tool, care must be taken to load files in the proper order so that foreign-key integrity is preserved. When loading multiple files, loading is sequential and a failure in any file will terminate the loading process and roll back all previously loaded data.
3.15.182.159