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_file($xmlfile)
or die("Error while parsing the document");
$root = $dom->document_element();
// Any of these dumps should show a valid node...
var_dump($dom->get_element_by_id('HardwarePlatform'));
$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.org/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