from config.xml import XmlConfig
xmlstring = """<config>
    <services>
        <service type="ping">
            <defaults>
                <ping_count>4</ping_count>
                <service_name>connectivity</service_name>
                <message_template>There was a %s%% ping return from host %s</message_template>
                <ping_binary>/bin/ping</ping_binary>
                <command>ping</command>
                <ok_threshold>67,100</ok_threshold>
                <warn_threshold>26,66</warn_threshold>
                <error_threshold>0,25</error_threshold>
            </defaults>
            <hosts>
                <host name="shell1.adytum.us">
                    <escalation enabled="false">
                        <group level="0">
                            <email>oubiwann@myrealbox.com</email>
                            <email>oubiwann@yahoo.com</email>
                        </group>
                        <group level="1">
                            <email></email>
                        </group>
                    </escalation>
                    <scheduled_downtime></scheduled_downtime>
                </host>
            </hosts>
        </service>
        <service type="http">
            <defaults/>
            <hosts>
                <host/>
            </hosts>
        </service>
    </services>
    <system>
        <database type="zodb">
            <directory>data/zodb</directory>
            <host>localhost</host>
            <port></port>
            <user></user>
            <password></password>
        </database>
    </system>
    <constants>
    </constants>
</config>"""
cfg = XmlConfig(xmlstring)
print cfg._root.getchildren()
print cfg._root.find('services')
print cfg._root.find('services').getchildren()
print cfg._root.find('services').find('service')
print cfg._root.find('services').find('service').items()
print cfg._root.find('services').find('service').getchildren()
print cfg.__dict__
print cfg.services.__dict__
print cfg.services.service[0].__dict__
