UAProf parsing with PHP (WAP)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Udo Giacomozzi

    UAProf parsing with PHP (WAP)

    Hello,

    I want to parse a UAProfile XML file to know the capabilities of the
    clients WAP cellular phone. Has anybody already written some PHP code
    that does this?

    Anyway, I haven't done anything with XML under PHP before and I have
    some problems with the XML DOM parser of PHP. In particular I am not
    able to access a specific node in the XML document that contains the
    screen size, in pixels, of the device. Here is my test code, maybe
    someone can show me the problem:

    <?php

    $xmlfile = "http://communication-market.siemens. de/UAProf/S55_05.xml";

    $dom = domxml_open_fil e($xmlfile)
    or die("Error while parsing the document");

    $root = $dom->document_eleme nt();


    // Any of these dumps should show a valid node...

    var_dump($dom->get_element_by _id('HardwarePl atform'));

    $ctx=xpath_new_ context($dom);

    $ctx->xpath_register _ns("rdf",
    "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
    $ctx->xpath_register _ns("prf",
    "http://www.wapforum.or g/profiles/UAPROF/ccppschema-20000405#");
    $ctx->xpath_register _ns("rdfs",
    "http://www.w3.org/2000/01/rdf-schema#");

    var_dump($ctx->xpath_eval('/rdf:Description/prf:component/rdf:Description/prf:ScreenSize' ));
    var_dump($ctx->xpath_eval('/Description/component/Description/ScreenSize'));
    var_dump($ctx->xpath_eval('/rdf:RDF/rdf:Description/prf:component/rdf:Description/prf:ScreenSize' ));
    var_dump($ctx->xpath_eval('/RDF/Description/component/Description/ScreenSize'));


    ?>

    Thanks in advance,
    Udo

    --
    To reply by e-mail, use following address:
    udonews AT nova-sys.net
Working...