Working with XML Namespaces

The SDL Passolo XML parser is based on MSXML. To use this parser it is necessary to specify the required namespaces.

Otherwise it is not possible to refer to attributes in documents with namespaces via XPath expressions. The declaration of namespaces is performed automatically by Passolo if the namespaces are specified in the root element. The namespace specifications specified in the root element (and only these) are automatically accepted and applied by SDL Passolo.
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="3B1878104CA04553BA4469269337C4DC">File</system:String>
<system:String x:Key="66AFC8172E354e4cAD886DB2E2CC981C">Open</system:String>
<system:String x:Key="5604CB812A174d2f926B7748B7171C6C">Save</system:String>
<system:String x:Key="068738D4008F449d86B45238D4D0044F">Save As</system:String>
<system:String x:Key="F52DC21A5C3C45499C6FC623835BCFF9">Quit</system:String>
<system:String x:Key="2AC52DE4D2B74f84AB8D17EAA7E1B738">Edit</system:String>
<system:String x:Key="DAE9050AAB9B436eBED0A5191BAFC917">Find</system:String>
<system:String x:Key="CECCF72250C444b5B28478410267982E">Replace</system:String>
<system:String x:Key="736EC0206F574b6cB47994DBAAA86160">Copy</system:String>
<system:String x:Key="6E4262F3873E48FB8B48C866CFD35F4C">Cut</system:String>
<system:String x:Key="373FC6B7F4DD4A12A4D63081859B2867">Paste</system:String>
</ResourceDictionary>

In the example above the namespaces http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/winfx/2006/xaml and clr-namespace:System;assembly=mscorlib are used. The identifiers of the last two namespaces are x and system. The first namespace is the default namespace and does not have an identifier.

Namespace prefixes should be used in XPath expressions and in the list of attributes, e.g. for the ID of an element, the qualified name x:Key is displayed, not just Key. Elements and attributes that do not have a namespace prefix are automatically derived from the default namespace. A namespace prefix still has to be provided in the settings for these elements and attributes, however.

Passolo uses the prefix pdns for the default namespace. An XPath expression for an XLIFF file that does not specify the XLIFF namespace would look like this:


./child::note

If the fiile contains the XLIFF namespace as default namespace the XPath expression would be as follows:

../child::pdns:note