Category:HowTo:XML:Schema

From Snom User Wiki

Jump to: navigation, search

Author: Alexander Feldt

Contents

Preconditions

The XML Schema is available on snom IP phones for firmware versions 8.7.X onwards. However the below XSD schema can also be used to verify XML applications for firmware versions from 8.4.18 onwards. (Restrictions apply, see below). It allows to validate the syntax for the following XML applications:

XML schema files can be downloaded according to the firmware version installed on the phone:

Note: The below XML Schema file contains elements that are not yet implemented in 8.4.X FW versions.

Step 1: Choose a validation tool

In order to validate your own XML file you can choose between an offline or online XML validation tool:

Step 2: Open an XML file for validation

We will use the Altova xmlspy software suite to show how to use snom's XML schema file for validating an XML file, that was used as an example from a live system. Open "led2.xml":

<?xml version="1.0" encoding="UTF-8"?>
<SnomIPPhoneText>
 <Title>LED Control Feature</Title>
 <Text>This sample page demonstrates the Minibrowser LED control feature.</Text>
 <Led number="1">On</Led>
 <Led number="2">Blink</Led>
 <Led number="3">On</Led>
 <Led number="4">Blink</Led>
 <Led number="5">On</Led>
 <Led number="6">Blink</Led>
 <Led number="7">On</Led>
 <Led number="8">Blink</Led>
 <Led number="9">On</Led>
 <Led number="10">Blink</Led>
 <Led number="11">On</Led>
 <Led number="12">Blink</Led>
</SnomIPPhoneText>

Step 3: Assign the XML schema file

Result:

<?xml version="1.0" encoding="UTF-8"?>
<SnomIPPhoneText xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="minibrowser_8418.xsd">
 <Title>LED Control Feature</Title>
 <Text>This sample page demonstrates the Minibrowser LED control feature.</Text>
 <Led number="1">On</Led>
 <Led number="2">Blink</Led>
 <Led number="3">On</Led>
 <Led number="4">Blink</Led>
 <Led number="5">On</Led>
 <Led number="6">Blink</Led>
 <Led number="7">On</Led>
 <Led number="8">Blink</Led>
 <Led number="9">On</Led>
 <Led number="10">Blink</Led>
 <Led number="11">On</Led>
 <Led number="12">Blink</Led>
</SnomIPPhoneText>

Step 4: Start validation

After pressing "F8" the validation of the XML file will be carried out:

The "Messages" window will display the validation results, e.g. here the following error message can be seen:

File:xmlschema1_7.png

Step 5: Fix broken XML files

a) The error message indicates that the location of the <Led> tag is not expected under <SnomIPPhoneText> instead the structure shown in the "Elements" window is expected:

File:xmlschema1_8.png Solution: Move the "Text" tag below the last <Led> tag.

Result:

<?xml version="1.0" encoding="UTF-8"?>
<SnomIPPhoneText>
 <Title>LED Control Feature</Title>
 <Led number="1">On</Led>
 <Led number="2">Blink</Led>
 <Led number="3">On</Led>
 <Led number="4">Blink</Led>
 <Led number="5">On</Led>
 <Led number="6">Blink</Led>
 <Led number="7">On</Led>
 <Led number="8">Blink</Led>
 <Led number="9">On</Led>
 <Led number="10">Blink</Led>
 <Led number="11">On</Led>
 <Led number="12">Blink</Led>
 <Text>This sample page demonstrates the Minibrowser LED control feature.</Text>
</SnomIPPhoneText>

After performing another validation, the following message is displayed:

The error message indicates that the syntax of the <Led> content is not correct.

Instead the numeration shown in the "Info" and "Messages" window is expected. Furthermore when typing into the <Led> value field, a list of possible values will be shown:

Solution: Change the values for the <Led> tag accordingly to small letters.

<?xml version="1.0" encoding="UTF-8"?>
<SnomIPPhoneText xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="minibrowser_8418.xsd">
 <Title>LED Control Feature</Title>
 <Text>This sample page demonstrates the Minibrowser LED control feature.</Text>
 <Led number="1">on</Led>
 <Led number="2">blink</Led>
 <Led number="3">on</Led>
 <Led number="4">blink</Led>
 <Led number="5">on</Led>
 <Led number="6">blink</Led>
 <Led number="7">on</Led>
 <Led number="8">blink</Led>
 <Led number="9">on</Led>
 <Led number="10">blink</Led>
 <Led number="11">on</Led>
 <Led number="12">blink</Led>
</SnomIPPhoneText>

After performing another validation, the following message is displayed:

File:xmlschema1_12.png

Congratulations, your XML schema was validated successfully.

This category currently contains no pages or media.

Personal tools
Interoperability