How Do I Connect to an XML Data Source?
In this article we demonstrate how to connect a Report Template to an XML data source. For more details about the Connection Editor, see the Connection Editor Reference.
- An XML Data Source (file or URL)
- A good network connection to your file or URL.
Please note, if you are inside a corporate network and you cannot access our Windward cloud-hosted demo data source, your firewall may be blocking you from access. Please consult with your system or network administrator for assistance.
From Microsoft Word, Excel, or PowerPoint, navigate to the AutoTag Manager tab. Once on the AutoTag Manager tab, click on the upper half of the Data Sources button. This will bring up the Connection Editor.
- In the Connection Editor window click on the New tab.
- Click on XML (XPath 1.0) or XML (XPath 2.0) in the Web/File section. The Details pane will change to prompt you for your data source details.
- Enter a Name for your data source connection.
- Enter the full pathname, or a URL, to your XML file.
- (Optional) Choose your Authentication Protocol. The Authentication Protocol you choose will set the contents of the contextual Properties window below. For additional information, see our article Data Access Providers and Authentication Protocols.
- (Optional) Enter the Authentication Protocol Properties, based on the choice of Authentication Protocol above.
- (Optional) Schema -- A schema provides the structure of your XML file. This provides significant additional information for Report Designer: all possible nodes (the XML file just gives us the nodes used); the data type of each node; and a description for each node (which we then display as a tooltip in the data source schema tree). You can set this to:
- No schema - You have no schema file.
- Use xsi:schemaLocation - The XML file lists the schema using an xsi node. Sometimes (not always) the schema file is on the web at that location. With this setting it will read the file from that location. Again, many times there is no file at the specified location and the URL is just a name.
- File / URL - Provide a local copy of the schema file. In this case you can also optionally choose an Authentication Protocol and set its Properties in the same fashion as for the XML File/URL above.
- Click on Add, then Test, to test your connection. If all parameters and credentials are correct and a connection is made, you will receive a successful notification.
- Click on Close to save your information.
Root Directory: This is the "default directory" for any Import Tag requests where the requested file does not have an absolute path. If left blank, Report Designer will use the directory where the data source file is located. If the data source is not a file it will use the directory where the template is located.
To use Windward's sample templates, enter these credentials.
- File/URL: http://xml.windward.net/Northwind - Data.xml
- Credentials: ‘Use Windows Identity’ (no user credentials are needed for the Windward sample)
When you set all the properties for XML you will get a connection string in the form
If you define the schema, it will have a 2nd connection string for the schema. As shown below, the null 2nd parameter is the connection string for the schema.
new SaxonDataSourceImpl (“Url=C:\test\SouthWind.xml;AccessProvider=FileSystem;”, null );
new SaxonDataSource (“Url=C:\test\SouthWind.xml;AccessProvider=FileSystem;”, null );