4.3. UAProf Profile Resolution

Now you know how to find the URL of a UAProf profile, the next step is to download it and retrieve some attribute values from it. Retrieving a UAProf attribute value is not as simple as retrieving the value of an HTTP header like Accept or User-Agent. The reason is that UAProf is a complex specification that has taken many things into consideration. This makes UAProf powerful but also makes it contains a lot of rules. For example:

To find the final value of an attribute, we have to perform a process called profile resolution:

When a default value merges a non-default value, the default value is always overriden by the non-default value. When a non-default value merges another non-default value, the UAProf parser follows the resolution rule of the attribute. The UAProf specification has defined three resolution rules (Locked, Override and Append) that are used to tell the UAProf parser how to merge non-default values. Every attribute are associated with one of the resolution rules. The meanings of the three resolution rules are provided in the table below:


Resolution rule

Meaning

Locked

The attribute's final value is the first non-default value.

For example, the resolution rule of the ScreenSize attribute is Locked.

Override

The attribute's final value is the last non-default value.

For example, the resolution rule of the ColorCapable attribute is Override.

Append

The attribute's final value is the list of all non-default values.

For example, the resolution rule of the CcppAccept attribute is Append. (The CcppAccept attribute tells us the MIME media types acceptable by a mobile device.)

Let's say the first non-default occurrence of the CcppAccept attribute contains the items:

image/bmp
image/gif

The second non-default occurrence contains the items:

image/jpeg
image/png

After profile resolution, the CcppAccept attribute contains the items:

image/bmp
image/gif
image/jpeg
image/png


For more details about profile resolution, please refer to the UAProf specification.


4.3.1. Free Library / Tool for Retrieving UAProf Attribute Values

As you can see above, writing a UAProf parser to retrieve the values of attributes according to the UAProf specification requires a lot of work. Fortunately there is an open source library called DELI that can be used to query UAProf or CC/PP profiles in Java Servlets. It can be downloaded free of charge from the website http://delicon.sourceforge.net/.


4.3.2. A Simple Way for Retrieving UAProf Attribute Values

As mentioned earlier, determining the final value of an attribute involves a lot of steps according to the UAProf specification. However, in real life, mobile device manufacturers and mobile operators keep things simple. In most situations:

Hence, to get the final value of an attribute, no more profile merging is necessary. All you need to do is to obtain the URL of the user agent profile, download the user agent profile and then retrieve the attribute values you needed from the document using any method you like, such as simple text matching and XML parsing.

The advantage of using this way is that it is very simple and straightforward and it works most of the time. The disadvantage is that the attribute values retrieved may be incorrect if the above three points are not true.


Previous Page Page 9 of 10 Next Page


Feedback Form (ExpandCollapse)

What do you think about this web page?






(Optional) Please provide us more details. For example, suppose you select option 2 above, can you tell us specifically what information is missing? You can also suggest anything that can help us improve this web page.

(Optional) Your name:

(Optional) Your email address:

Please enter again to confirm:

Due to the amount of messages we received, we may not be able to reply to all messages.