XtNodeParser is a PHP based class which is inspired from xtgem visual mobile site building tool. This parser covert
< xt:some_tagname ...some attribute ../>
For example
< xt:tdate format="y-m-d" />
will return current date and time Full list of XtNodeParser functionality can be found on there developers site.
How to Write Your own extension
If Your node is for example
<xt:sometag attr="value"/>
then create a new filename inside XtNodeParser/Node like SomeTagNode.php (must be equal to tagname and must be end with Node) and php code for this
<?php
/*
* This file is part of XtNodeParser
*
* (c) 2013 Shushant Kumar
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
*
* @package XtNodeParser
* @author Shushant Kumar
* @link http://github.com/punkboy/XtNodeParser
*/
namespace XtNodeParser\Node;
class SomeTagNode extends Node implements \XtNodeParser\Implement\Node
{
public function __construct(&$mXmlFeed = null)
{
parent::__construct($mXmlFeed);
$mXmlFeed = null;
}
public function __toString()
{
$mXmlAttr = $this->getAttributesAsArray();//retuen attribute as key and value
return $mXmlAttr['attr']// will output value;
}
public function __destruct()
{
parent::__destruct();
}
}
Fork From Github https://github.com/punkboy/XtNodeParser Follow me on Github to get Update https://github.com/punkboy