XML-lister

XML lister is a small program that lists the elements, values and attributes of XML files.

<?xml version="1.0"?>
<layout>
    <default>
        <reference name="root">
            <reference name="content">
                <block name="product.info">
                    <action method="test">
                        <param>test</param>
                        <param2>test2</param2>
                    </action>
                </block>
            </reference>
        </reference>
    </default>
</layout>

XML lister will print the following list:

layout  
layout/default  
layout/default/reference    
layout/default/reference@name   root
layout/default/reference/reference  
layout/default/reference/reference@name content
layout/default/reference/reference/block    
layout/default/reference/reference/block@name   product.info
layout/default/reference/reference/block/action 
layout/default/reference/reference/block/action@method  test
layout/default/reference/reference/block/action/param   test
layout/default/reference/reference/block/action 
layout/default/reference/reference/block/action/param2  test2
layout/default/reference/reference/block/action 
layout/default/reference/reference/block    
layout/default/reference/reference  
layout/default/reference    
layout/default  
layout  

A few days ago I wanted to find out if there are places in Magento layout XML files where reference elements are used inside other reference elements. With XML lister it becomes really easy to find places like this.

find app/design -name '*.xml' | xargs xml-lister --filename | grep reference/reference

With the list it becomes really easy to find the files where a certain construct is used.

Welcome

My name is Peter Stuifzand. You're reading my personal website.

Profiles