Technical FAQs

Ask a Question

Using XML Query Modules with an XML that has a namespace

Goals and Symptoms

Using the XML document below with an XML Query Module normally you could use this query to find the price of the first HOEP value

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="" ?><IMODocument docID="DispUnconsHOEP" xmlns="" xmlns:xsi="" xsi:schemaLocation="">
<DocTitle>Hourly Ontario Energy Price (HOEP) Report</DocTitle>

Below is a typical xml document

Causes and Fixes

However, some xml documents contain a namespace, that makes it difficult for the XML Import module to define the nodes underneath the namespace.

So a generalized query that ignores namespace can be built like this:


Here is a break down of the query:

//*[local-name()='HOEPs'] = Return all nodes in the document with the name 'HOEPs' regardless of position

/*[local-name()='HOEP'][1] = Return all children with name 'HOEP' that have the position 1

/*[local-name()='Price'] = Return all children named 'Price'

The XML Import uses the Microsoft XML tools.

Below is a useful website containing useful Xpath information in the form of a tutorial. Select the "Next Chapter" link to start the tutorial.

Original article#
Date Created: June 08, 2010
Last Revised: June 17, 2010
Original Author: RU
All content © 1992-2010 Schneider Electric

Was this helpful?
What can we do to improve the information ?