dox Executable Documentation

Parse children

Children

$this->when->iParse('<father><son/><daughter/></father>');
$this->then->theResultShouldBe('[
            {   "element":"father",
                "children":[
                    { "element":"son" },
                    { "element":"daughter" }
                ]
            }
        ]');

Empty child

$this->when->iTryToParse('<one><two></two></one>');
$this->then->theResultShouldBe('[
            {   "element":"one",
                "children":[
                    { "element":"two" }
                ]
            }
        ]');

Text child

$this->when->iParse('<text>Some Text</text>');
$this->then->theResultShouldBe('[
            {   "element":"text",
                "children":[
                    { "text":"Some Text" }
                ]
            }
        ]');

Grand child

$this->when->iParse('<one><two><three/></two></one>');
$this->then->theResultShouldBe('[
            {   "element":"one",
                "children":[
                    {   "element":"two",
                        "children":[
                            { "element":"three" }
                        ]
                    }
                ]
            }
        ]');