Revision [1210]

Last edited on 2011-10-28 08:37:12 by FsseInfo
Additions:
==PHP Lightweight XML Parser==
==PHP DOM Tree Based Parsers==
PhpDomPlus
PhpDomXpath
==PHP DOM Stream BAsed Parsers==
Deletions:
==Lightweight==
==Serious==


Revision [1189]

Edited on 2011-10-14 07:37:34 by FsseInfo
Additions:
==Lightweight==
==Serious==
PhpDom
Deletions:
==PHP & XML==


Revision [804]

Edited on 2009-05-20 04:52:31 by FsseInfo
Additions:
XmlReader
PhpXsl


Revision [800]

Edited on 2009-05-19 11:24:27 by FsseInfo
Additions:
SimpleXml
XmlWriter
Deletions:
SimpleXML
XMLWriter


Revision [799]

Edited on 2009-05-19 11:24:10 by FsseInfo
Additions:
==PHP & XML==
SimpleXML
XMLWriter
Deletions:
==PHP & SimpleXML==
Here is an example of a XML navigator / simplifier written in SimpleXML !
%%(php)
function nav($x,$level=1) {
foreach ($x->children() as $ng) {
echo str_repeat(' ',$level), $ng->getName();
$haschildren=count($ng->children());
if (!$haschildren) {
echo '=', $ng;
}
foreach ($ng->attributes() as $a => $v) {
echo ' ' , $a, '=', $v ;
}
echo PHP_EOL ;
if ($haschildren) {
nav($ng,$level+1);
}
}
}
$file = $argv[1];
if (file_exists($file)) {
$xml = simplexml_load_file($file);
nav($xml);
}
%%
==input==
%%(xml)
<?xml version="1.0" encoding="UTF-8"?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" version="1.1" creator="Nokia Sports Tracker" xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
<metadata>
<name>2008/09/01 8:49 am</name>
<desc>Cycling</desc>
<author><name>Joe Average</name></author>
<time>2008-09-01T08:49:40.72</time>
</metadata>
<trk>
<name>2008/09/01 8:49 am</name>
<trkseg>
<trkpt lat="51.464503" lon="-0.169937">
<ele>32.5</ele>
<speed>0.3</speed>
<course>318.2</course>
<desc>Speed 0.3 mph Distance 0.00 mi</desc>
<time>2008-09-01T08:49:43.31</time>
<name>1</name>
</trkpt>
%%
==output==
%%
metadata
name=2008/09/01 8:49 am
desc=Cycling
author
name=Joe Average
time=2008-09-01T08:49:40.72
trk
name=2008/09/01 8:49 am
trkseg
trkpt lat=51.464503 lon=-0.169937
ele=32.5
speed=0.3
course=318.2
desc=Speed 0.3 mph Distance 0.00 mi
time=2008-09-01T08:49:43.31
name=1
%%


Revision [731]

The oldest known version of this page was created on 2008-09-01 15:27:47 by FsseInfo
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki