XtNodeParser xml Node Parser inspired From xtgem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    XtNodeParser xml Node Parser inspired From xtgem

    XtNodeParser is a PHP based class which is inspired from xtgem visual mobile site building tool. This parser covert
    HTML Code:
    < xt:some_tagname ...some attribute ../>
    For example
    HTML Code:
    < 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
    HTML Code:
    <xt:sometag attr="value"/>
    then create a new filename inside XtNodeParser/Node
    like <b>SomeTagNode.php</b> (must be equal to tagname and must be end with Node)
    and php code for this
    PHP Code:
    <?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
    Attached Files
Working...
X