Search

Module: Editor

Version: 2.2.1 +

User: Developer

Object Type: Data Object

Parent of:

no children

Child of:

- XmlNode

 

Description

With the XmlField object, you can retrieve the values of elements in an XmlNode.

Properties

DebugLogMode (from version 4.1)

Indicates the level of detail of debug information that is logged when running a Futurama application (website, webservice, console application) to the trace, a logfile, a database etc. The possible values are:

  • None: no debug information is logged
  • Simple: only basic information is given
  • Extended: in addition to the information in the Simple mode the values of all the properties of the object are shown

IsPublic

Possible values are 'True' or 'False'. If the value is 'False', then the object can only be used within the document where it is created. If the value is 'True', then also from other Futurama documents can be referred to this object. This means that changes in the object also affect the document in which is referred to this object. If the value is 'True' and you attempt to move or delete the object, a warning will be given. To limit these warnings to a minimum it is recommended to set IsPublic to 'True' only when necessary.

Rank (from version 5.1)

Possible values are '0' or '1'. If the value is '1', then the XPath query returns a vector as a result, so that the XmlField holds a vector as its value. If the value is '0', then the XmlField will hold a single value (scalar).

XmlName

The name of the object as it is shown in the source of the website. By default the XmlName is equal to the name given in the property (Name) with spaces replaced by underscores, but you are free to change it.

(Name)

The name of the object.

Comment

Here a comment can be entered. For example a short description of the object.

ID

The unique identification number of the object. This number is automatically generated by Futurama on the moment of creation. This number can be used when searching for a certain object in the Find Window.

ReturnDefaultIfAbsent (from version 18.07)

If True, the XmlField will return a default value if the xpath result is empty (that is, no matching node is found). The default value will be 0, 0.0, “”, 1-1-1753 or false for datatype=long, double, string, date and boolean with rank 0. For rank 1, long[0], double[0], string[0], date[0] and bool[0] will be returned. If False, an error will be thrown.

ReturnDefaultIfEmpty (from version 18.07)

If True, the XmlField will return a default value if the xpath results in an empty node or empty nodes (for example or ). The default value will be 0, 0.0, “”, 1-1-1753 or false for datatype=long, double, string, date and boolean with rank 0. For rank 1, long[0], double[0], string[0], date[0] and bool[0] will be returned. If False, an error will be thrown.

XPath

Here you can enter an XPath 1.0 query. XPath is a query language for selecting nodes from an XML document. Here you can enter which data out of the XML of the XmlNode should be returned as the value of the XmlField.

Example

This example shows how the XmlNode and XmlField objects are used to import XML data into Futurama.

Download

Download the Futurama Document XMLNodeField Example.

Description

  1. Open the XML-document which is contained in the zip-file in the Futurama Editor (Version 4.2.1 or later).
  2. Here a n input Node can be seen that holds a Fixed of type String. In this Fixed an XML datafile is written as an example. Normally, you would read the XML data from an external file.
  3. The XmlNode 'Data' has the DataFile Fixed as its source. When you evaluate the node, you can see the content of the data in XML structure. Notice that a namespace has been declared in the NameSpaces property.
  4. The two XmlFields are used to derive the value of the input elements in the data. The first one is a double, the second one a date. Notice that the format of the date has been declared in the FormatInfo property.

Memory usage

When Futurama reads XML in an XMLNode the original document is completely loaded in memory to evaluate the xpath queries as described by the developer. Memory usage for these documents is high. There are ways to reduce the memory for XmlNodes and XmlFields. See this page for more information.

Performance XML operations

The performance op XML operations can be improved by reducing the number of times an external XML-file is loaded. See the support page Performance XML operations for a couple of examples to improve the performance.

Related Topics

- Futurama Objects: The Atlas chapter that describes all Futurama objects. See the Data section for a description of the type of objects this object belongs to.

- XmlNode

Relevant Tutorials

- Reading and processing XML-data in Futurama: This tutorial shows you how to read an XML-file into Futurama, and how you use and process the content of it.

- W3 schools XPath: Tutorials about XPath and it's possibilities, syntax and the like.

Updated: 2018-06-26