The Most Exciting Mobile Community on the Planet

Download Latest WURFL
Last Updated: October 21, 2009
What's a Patch File?
Web Patch(recognize web browsers)

Deploying WURFL
Introducing the new smarter PHP and Java APIs *
Java
WALL (old WALL on new API)
WNG - WALL Next Generation
PHP
(preview .Net version, still much better than anything produced before)
(*) The new APIs are distributed with a GPL License.


TRAC: report bugs/CRs
Using TRAC to report bugs and requests changes
WURFL API (Java, PHP, .Net)
WNG
WALL (new retrofitted WALL lib)

Documentation
!!! Capabilities !!!
Video Testing

About WURFL
What's the WURFL?
What can the WURFL
  do for me?

What's so smart
  about the WURFL?

WURFL and UAProf
Voices from the Net
WURFL Pronunciation

FAQ

Contributions & Attributions
WURFL-based apps
WURFL Endorsements
WALL-based apps
License
Get Involved!
Contribute Device Info

WURFL Utilities
Utilities, uaprofile2wurfl.pl, Alembik, mDevInf, Thumbnails, Wallify, Image Server, Tera-WURFL, GAIA Trascoder, Mobile Web Toolkit, PHP Image Rendering Library, PHP Image Rendering Library (II), FastWurfl, Apache Mobile Filter

Credits



Luca Passani

Old APIs
(too be deprecated and removed)
Old Java API and WALL
Perl
Ruby
Python
XSLT Tools
C++ tools

Luca Passani is a Forum Nokia Champion

SourceForge.net Logo

http://www.mobilopen.org/

http://tinurl.mobi/

http://www.mob4hire/
Crowdsourced Mobile Application Testing
 

WURFL Patch File
Applying your local fixes to the WURFL


by Luca Passani
     passani at eunet dot no
     luca dot passani at openwave dot com

While everyone can patch their own copy of the WURFL file for their own purposes, real applications may find this approach hard to manage.
The idea behind WURFL is that you get a newer version of the WURFL file as more accurate information becomes available and is added to the WURFL file.
Modifying one's private copy of the WURFL makes the update process error-prone and hard to manage.
The introduction of the WURFL 'patch file' helps with this. Developers can add a 'wurfl_patch.xml' file to their system, which stores modified/enhanced groups and capability lists for new or existing WURFL devices.
When the WURFL is parsed, the patch file is also imported to build a modified version of the device database.

When to use the patch
There may be different reasons why one wishes to use a patch file. Here are some (there may be others):
  • An existing device contains wrong data
    You fix your local version of the WURFL by overriding existing devices and defining new capabilities (or overriding existing ones).
    In this case, you may want to tell the WURFL maintainer about your findings, so we can fix the official WURFL for the whole community.
  • Your application is very specific
    You need capabilities which are not in the WURFL and are unlikely to be added (i.e. the WURFL is too general for your needs). You define the capabilities in the patch file and update your WURFL without interference.
  • Capabilities are OK, but you have your own reasons to assign them different values
    You can use the WURFL file to override those capability values and still update the WURFL independently
What does the patch file look like?
The patchfile is very similar to the WURFL itself (but hopefully much shorter!). Bialetti is an Italian coffee-maker manufacturer. I'll add coffee-maker support for the WURFL with a patch:

wurfl_patch.xml
<wurfl_patch>
  <devices>
    <device user_agent="" fall_back="root" id="generic">
      <group id="magical_powers">
         <capability name="makes_good_coffee" value="false" />
         <capability name="average_coffee_preparation_time"
                   value="0" />
      </group>
      <group id="display">
	<capability name="resolution_height" value="200"/>
	<capability name="lucas_capa"
                   value="0"/>
      </group>
      <group id="new_group">
	<capability name="new_capa1"
                value="false"/>
	<capability name="new_capa2"
                value="0"/>
      </group>
      </device>
    <device user_agent="Nokia 20" fall_back="generic"
             id="nokia_generic_series20">
      <group id="new_group">
	<capability name="new_capa1" value="true"/>
	<capability name="new_capa2" value="34832798"/>
      </group>
      <group id="display">
	<capability name="resolution_height" value="3300"/>
      </group>
    </device>

    <!-- Adding a Coffeee Pot to the WURFL -->
    <device id="bialetti_ver61" user_agent="Bialetti 6.1"
           fall_back="generic">

      <group id="magical_powers">
         <capability name="makes_good_coffee"
            value="true" />
         <capability name="average_coffee_preparation_time"
            value="5" />
      </group>
      <group id="display">
	<capability name="resolution_width" value="190"/>
	<capability name="resolution_height" value="140"/>
	<capability name="lucas_capa" value="34832798"/>
      </group>
    </device>
  </devices>
</wurfl_patch>
There are a few things to observe about the patch file:
  • wurfl_patch and devices enclose the patch
  • If you add new groups and or capabilities to the WURFL for some devices, you *must* initialize them by overriding generic values and providing corresponding groups and capabilities with the values for unrecognized devices.
  • If the 'id' of a certain device already exists, then you are overriding an existing device. Otherwise, it's effectively a new device you are defining.
  • If you override an existing device, you are not allowed to change the User Agent string associated to the device by the WURFL.
  • If you are defining a new device, you must provide a User Agent string.
  • If you override an existing device, the capabilities you introduce are either:

    • added to the list of capabilities for that device (the capability was not previously defined in the original device).
    • used to modify the value of the capability (the capability was previously defined in the original device)

    Of course, this happens automatically, so your patch will keep working even if the capabilities in the patch are added to the official WURFL version.
Example:
Let's assume we have a wurfl_patch.xml file like the one above and a mini wurfl.xml file like the one which follows:
<?xml version="1.0" encoding="UTF-8" ?> <wurfl>
 <devices>
  <device fall_back="root" id="generic" user_agent="">
   <group id="wml_ui">
    <capability name="access_key_support" value="false" />
     <capability name="wrap_mode_support" value="false" />
    </group>
   <group id="display">
    <capability name="resolution_width" value="90" />
     <capability name="resolution_height" value="40" />
    </group>
  </device>
  <device user_agent="Nokia 20" fall_back="generic"
         id="nokia_generic_series20">
   <group id="display">
    <capability name="resolution_width" value="260" />
     <capability name="resolution_height" value="440" />
    </group>
  </device>
  <device user_agent="Nokia 30" fall_back="nokia_generic_series20" 
             id="nokia_generic_series30">
   <group id="wml_ui">
    <capability name="access_key_support" value="true" />
    </group>
   <group id="display">

    <capability name="resolution_width" value="96" />
     <capability name="resolution_height" value="65" />
    </group>
  </device>
  <device user_agent="Nokia 40" fall_back="nokia_generic_series30" 
             id="nokia_generic_series40">
   <group id="display">
    <capability name="resolution_width" value="128" />
     <capability name="resolution_height" value="128" />
    </group>
  </device>
  <device user_agent="Nokia 60" fall_back="nokia_generic_series40" 
             id="nokia_generic_series60">
   <group id="wml_ui">
    <capability name="access_key_support" value="false" />
    </group>
  </device>
 </devices>
</wurfl>
The merged patch file (i.e. wurfl.xml patched with wurfl_patch.xml)
will be equivalent to this:
<?xml version="1.0" encoding="UTF-8"?>
<wurfl>

  <devices>
    <device fall_back="root" id="generic" user_agent="">
      <group id="wml_ui">
        <capability name="access_key_support" value="false"/>
        <capability name="wrap_mode_support" value="false"/>
      </group>
      <group id="display">
        <capability name="resolution_width" value="90"/>
        <capability name="resolution_height" value="200"/>
        <capability name="lucas_capa" value="0"/>
      </group>
      <group id="magical_powers">
        <capability name="makes_good_coffee" value="false"/>
        <capability name="average_coffee_preparation_time" value="0"/>
      </group>
      <group id="new_group">
        <capability name="new_capa1" value="false"/>
        <capability name="new_capa2" value="0"/>
      </group>
    </device>
    <device user_agent="Nokia 20" fall_back="generic"
          id="nokia_generic_series20">
      <group id="display">
        <capability name="resolution_width" value="260"/>
        <capability name="resolution_height" value="3300"/>
      </group>
      <group id="new_group">
        <capability name="new_capa1" value="true"/>
        <capability name="new_capa2" value="34832798"/>
      </group>
    </device>
    <device user_agent="Nokia 30"
               fall_back="nokia_generic_series20" 
               id="nokia_generic_series30">
      <group id="wml_ui">
        <capability name="access_key_support" value="true"/>
      </group>
      <group id="display">
        <capability name="resolution_width" value="96"/>
        <capability name="resolution_height" value="65"/>
      </group>
    </device>
    <device user_agent="Nokia 40"
               fall_back="nokia_generic_series30" 
               id="nokia_generic_series40">
      <group id="display">
        <capability name="resolution_width" value="128"/>
        <capability name="resolution_height" value="128"/>
      </group>
    </device>
    <device user_agent="Nokia 60"
               fall_back="nokia_generic_series40" 
               id="nokia_generic_series60">
      <group id="wml_ui">
        <capability name="access_key_support" value="false"/>
      </group>
    </device>
    <device id="bialetti_ver61" user_agent="Bialetti 6.1"
          fall_back="generic">
      <group id="magical_powers">
        <capability name="makes_good_coffee" value="true"/>
        <capability name="average_coffee_preparation_time"
          value="5"/>
      </group>
      <group id="display">
        <capability name="resolution_width" value="190"/>
        <capability name="resolution_height" value="140"/>
        <capability name="lucas_capa" value="34832798"/>
      </group>
    </device>
  </devices> 
</wurfl>



Copyright © 2007-2009, Luca Passani