Search

Module: Editor

Version: 2.2.1 +

User: Developer

Object Type: Data Object

Parent of:

- Fixed

- Formula

- Reference

- XmlField

- XmlNode

Child of:

- Document

- Node

- XmlNode

 

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

  1. Open the XML-document which is contained in the zip-file in the Futurama Editor (Version 4.2.1 or later).
  2. 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.
  3. 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.
  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.

Testfiles

The XML-data that is represented by an XmlNode can be tested in the Editor by creating a testfile. In the menu-item Tools|Settings in the menubar in the Editor the option 'TestFileNameXmlBuilder' can be used to indicate the name and location of this testfile. Therefore the extension always has to be 'xml'. In the Document Explorer a rightclick on the Xmlode opens a contextmenu. In this menu select the option Debug|Create Testfile. On the location specified in the option 'TestFileNameXmlBuilder' an XML-file is created containing the XML-data. In this way it can be tested whether the structure and contents of the data is as expected.

Generating XSD files (Futurama 17.11+)

From Futurama 17.11 onward it is possible to generate a custom WSDL instead of the ‘generic’ WSDL. See Installation Futurama Webservice for more information. When modeling a custom WSDL the definition of the Request and Response of the webservice are laid down in a so called XSD file. In general an XSD file (XML Schema Definition) is a file that defines validation rules for XML, in this case the (XML) format of the Request and the Response. Constructing an XSD is not covered in the Futurama Support Site, for much information is available on the internet. However, to accommodate the construction of an XSD file, Futurama Editor contains functionality to generate a basic XSD file. In order to do this, perform a rightclick on the object and select Debug | Create xsd file. Futurama will open a Save As dialog window where the name and location of the XSD file can be specified. The generated XSD file only provides the basic structure. In order to make it work properly for the webservice under development it will need further alterations.

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.

- XmlField

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: 2014-06-30