Table of Contents
How to create a table from an XML file in wpDataTables
Say your car dealership software exports the current stock as an XML feed, and you want to show it on your website with filters for make, engine and year. wpDataTables reads XML from any URL it can reach, as long as the XML has one simple structure. You link a new table to the URL, and the table shows the feed’s latest data on every page load.
What XML structure can wpDataTables read?
wpDataTables reads XML with a single root node and one level of child nodes of the same structure. Each child node becomes a row, and its attributes become the cells:
<?xml version="1.0" encoding="UTF-8" ?>
<cars>
<car Make="BMW" Displacement="1.6" HP="116" Year="2003" />
<car Make="Audi" Displacement="3.5" HP="298" Year="2003" />
<car Make="Mercedes" Displacement="2.0" HP="257" Year="2002" />
</cars>
This is the start of the sample file cars_dummy_db.xml, a made-up car database. Use its URL to follow the steps below. Your XML also needs at least one row, and wpDataTables has to be able to open the URL from your server.
How do I create a table from an XML file?
Create a table linked to an existing data source, choose XML file as the source type, paste the URL and click Save Changes.
- Start a linked table. Go to wpDataTables → Create a Table and click Create a data table linked to an existing data source.
- Name the table. Click New wpDataTable and type a name, for example Car stock.
- Choose the source type. In the Data source tab, open Input data source type and choose XML file.
- Paste the URL. Paste the URL of the XML file or feed in Input file path or URL.
- Save the table. Click Save Changes. wpDataTables reads the XML, creates a column for each attribute and shows the table preview.

How do I set up the XML table after it is created?
Open the table settings and the column settings in the editor, and change what your visitors need. For the car sample, these settings make a compact table with filters:
| Where | Setting | Value |
|---|---|---|
| HP column | Displayed header | Horse power |
| Year column | Displayed header | Year of manufacture |
| Make and Displacement columns | Filter type | Selectbox |
| HP and Year columns | Filter type | Number range |
Click Save Changes when you are done. Read how to configure a table in the table editor and how to add filters for all options.
What are the limits of XML tables?
XML tables are read-only and follow the source file, so they share the limits of all linked tables:
What should I remember about tables from XML?
wpDataTables reads XML with one root node and one level of child nodes, and turns each child node into a row and each attribute into a cell. Create a linked table with XML file as the source type and the file’s URL, then set up the columns and filters. Keep the structure unchanged, and cache large files.
Where can I read more?
These pages cover other data sources and the next steps: