XtNodeParser xml Node Parser inspired From xtgem

Started on the old forum in June 2013 · view the original in the archive · old links redirect here

#parser #php #simplexmlelement #xml #xtgem

No replies · 528 views · started 13 years ago · 1 min read

shushant Developer · 207 posts #1

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

Attachments: master.zip

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close