XML Detection settings
Identify XML File type by content
Multiple XML file types can have the same file name extension (typically *.xml). SDL file support software distinguishes between these file types by matching the contents of the file with detection settings for the file type. A simple example of a detection setting is the root element required for a specific XML file type. You can specify detection settings in the Detection page of the XML file type settings.
| Root elements | One or more names used for the root element, for example |
| DOCTYPE declaration | For example: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
| xsi:schemaLocation | A URL used to specify the schema location. This matches |
| xmlns: declaration | One or more namespace URLs |
| XPath rules | One or more XPath rules |
Example - Specifying a root element
To specify a root element use the element name (no angle brackets), for example:
email
With this, the SDL file support software will match any XML file that has the root <email>, for example:
<email>
<sendto> John Brown </sendto>
</email>
Example - Specifying a schemaLocation URL
If you provide a schemaLocation: http://www.sdl.com/xml/SdlExample.xsd, then the SDL file support software will match any XML file that uses either of the following schemaLocations:
xsi:schemaLocation="http://www.sdl.com/xml/SdlExample.xsd"
xsi:noNamespaceSchemaLocation="http://www.sdl.com/xml/SdlExample.xsd"
Example - Specifying a namespace URL
If you provide a namespace http://www.w3.org/1999/ xhtml, then the SDL file support software will match any XML file that includes <html xmlns="http://www.w3.org/1999/ xhtml">.
Example - Specifying multiple root elements
If you specify two root elements, for example:
email
post
Then both the following XML files will match the new file type:
<email>
<sendto>Mary Brown</sendto>
</email>
<post>
<sendto>John Brown</sendto>
</post>
Example - Specifying any XML document
If you provide a root element name
*
(that is, an asterisk), any XML document will match this file type. Usually, if you have such a catch-all specification, you would position it at the bottom of the list of XML file types, so that more specific specifications take precedence.