Use the XML namespace properties tab to specify the namespaces defined in an XML response. PhixFlow needs this information because an XML namespace ensures the names, elements and attributes in the file are unique. An XML instance may contain element or attribute names from more than one XML vocabulary. If each vocabulary is given a namespace, the ambiguity between identically named elements or attributes can be resolved.
This setting is not available from the repository browser. It opens from:
- the HTTP Collector properties
- the File Collector properties when the File Type is XML
For information about the properties toolbar, and about the sections Parent Details, Analysis Models, Description and Audit Summary, see Common Properties. For a full list of all the PhixFlow property tabs and windows, see Property Tabs.
Basic Settings
Field | Description |
---|---|
Name | Enter a name for the XML namespace. The name must match the name you use in XPath expressions to extract data from the XML response. Example 1. Specify the name xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" Example 2. Specify the name
See HTTP Collectors for examples of using namespaces in XPath expressions to extract data from XML responses. |
Value | Value of the XML namespace. For example: http://schemas.xmlsoap.org/soap/envelope/ |
Using Default Namespaces
The following example illustrates how a default namespace defined in an XML response is handled.
XML Document
<?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:xmlns:company-com:message" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pf="urn:phixflow.message.com"> <soapenv:Body> <queryResponse> <result xsi:type="QueryResult"> <done>true</done> <queryLocator xsi:nil="true"/> <record xsi:type="pf:sObject"> <pf:type>Account</pf:type> <pf:Name>Company1</pf:Name> <pf:CreatedDate>2013-10-31T11:26:21.000Z</pf:CreatedDate> </record> <record xsi:type="pf:sObject"> <pf:type>Account</pf:type> <pf:Name>Company2</pf:Name> <pf:CreatedDate>2013-10-31T11:26:21.000Z</pf:CreatedDate> </record> <size>2</size> </result> </queryResponse> </soapenv:Body> </soapenv:Envelope>
Since this document uses a default namespace, "urn:xmlns:company-com:message"
, to refer to any element in an XPath expression that does not explicitly use a namespace you must use the default namespace. So to extract all record elements, you must first define a namespace in the collector for the default namespace. Suppose that you do and give this the name def
. Then the XPath (defined in the XPath field on the Response tab) to extract all record elements will be //def:record
.
In a stream that reads from this collector, any other namespaces defined in the document are used as normal. For example, to write the value from the element Name within each record element to a Stream attribute, you would use the attribute expression in.sf$Name
.