XML
It is possible to use an XML file as a Data Source, accessible to the Intelledox Infiniti application instance.
Key Concepts
XML (Extensible Markup Language) is a simple text-based format for representing structured information derived from SGML (ISO 8879). Originally designed to meet the challenges of large-scale electronic publishing.
XSD (XML Schema Definition) is a World Wide Web Consortium (W3C) recommendation that specifies how to formally describe the elements in an Extensible Markup Language (XML) document.
1. Create an XML and Schema files
Intelledox Infiniti XML Data Source requires two files (xl and xsd). Create and save these files in Intelledox Infiniti App Server.
XML: File with data to be used within Intelledox Infiniti.
<?xml version="1.0" encoding="utf-8"?>
<students>
<student id="0001">
<name>Justin</name>
<lastName>Example</lastName>
<subjects>
<subject>
<name>Science</name>
</subject>
<subject>
<name>Nature History</name>
</subject>
<subject>
<name>Biology</name>
</subject>
</subjects>
</student>
<student id="0002">
<name>Adam</name>
<lastName>Smith</lastName>
<subjects>
<subject>
<name>Software Development</name>
</subject>
<subject>
<name>Computers1</name>
</subject>
</subjects>
</student>
<student id="0003">
<name>Alex</name>
<lastName>Weiss</lastName>
<subjects>
<subject>
<name>Financial Engineering</name>
</subject>
<subject>
<name>Accounting</name>
</subject>
<subject>
<name>Excel III</name>
</subject>
</subjects>
</student>
</students>
XML Schema: Definition that specifies filter and display fields used in Data Object
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="students">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="student">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string" />
<xs:element name="lastName" type="xs:string" />
<xs:element name="subjects">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="subject">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
2. Create an Intelledox Infiniti XML Data Source in Manage
Navigate to Intelledox Infiniti Manage and click on Data Sources in the right side menu.
- Change Data Source Name to "XML Data Source".
- Select Connection Type as XML.
- Connection string has to reference both path files within Intelledox Infiniti App Server, using the key words:
xsd
andxml
.
xsd=C:\inetpub\wwwroot\Infiniti\Datasource\studentsDatabase.xsd; xml=C:\inetpub\wwwroot\Infiniti\Datasource\studentsDatabase.xml;
- Click "Test Connection" to validate Intelledox Infiniti is able to establish the connection with the xml and schema files.
- Click "Save".
Good Practice
It is recommended to enable "Allow Connection Export" as it will make the data source part of a project definition allowing to import it in a different environment.
3. Create a Hierarchical XPath Data Object
After saving the XML Data Source in Manage, click on "Data Objects" button. This will bring a new window with all available Data Objects for this particular Data Source.
-
Click on **"New Data Object". Provide following information:
Object Type: Hierarchical XPath
Data Object Name / Definition: students\student
Display Name: Students -
Add all filter fields clicking on "Add All >>" button.
-
Click "Save" button.
4. XML Validation
From V10.1 it is possible to require that the XML file refereced in connection string be validated against the XSD when accessed. For example if the xml is dynamically generated by some other system. To do this we add an additional parameter to the connection string.
Connection String Parameters | Description |
---|---|
validate | Value must be equal to 1. Requires that the XML be validated against the XSD everytime the XML is used in a project. |
Example Connection String##
xsd=C:\temp\Books.xsd; xml=C:\temp\Books.xml; validate=1
If the parameter is present and the value is equal to 1 the XML will be validated against the supplied XSD each time the XML is loaded in a project. An error thrown if the XML is not valid. Error messages are stored in the ErrorLog table.
Using this option will slow down the loading time of the XSD every time it is used in a project.
More Information
If you want to know more about XPath, please click here
Updated over 6 years ago