Module: Editor
Version: 2.2.1 +
User: Developer
Object Type: Data Object
Description
With the XmlNode object, XML can be read from a data source. You can specify the source file and whether all XML or a subset of it should be read.
From version 20.11 the way the XmlNode deals with an empty node set when evaluating its XPath has changed. Suppose in the XmlNode there was an element with <a attribute="true"><b attribute="false">5</b></a> as XML source (or selected XML node from its parent) and its XPath was "c", then in the versions before 20.11 this XmlNode had the incorrect XML element a. From version 20.11 this XmlNode has no XML element. In order to maintain the old behavior the compatibility mode 20_10 is introduced.
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.
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.
NameSpaces
By clicking the editing box in the NameSpaces property you can add one or more namespaces. A namespace should have a Prefix and a URI. The namespace defined can then be used in the XPath property. The NameSpace property only applies to the root XmlNode. If multiple XmlNodes are nested, the nested XMLNodes will inherit the namespaces of the root XmlNode.
FormatInfo
Here you should enter the format of the source data that should be read. For instance the pattern of the dates in your source file (e.g. dd-MM-yyyy), or the Decimal- and Groupseparator of the numbers in it (e.g. point and comma).
Source
Here you can enter the source file out of which the XML should be read. This property only applies to the root XMLNode.
XPath
Here you can enter an XPath 1.0 query. XPath is a query language for selecting nodes from an XML document.
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
- Open the XML-document which is contained in the zip-file in the Futurama Editor (Version 4.2.1 or later).
- Here an input Node can be seen that contains 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.
- The XmlNode 'Data' has the DataFile Fixed as its source. When you evaluate the node, you can see the contents of the data in XML structure. Notice that a namespace has been declared in the NameSpaces property.
- 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.