dimanche 10 juillet 2016

Сalculator with XML

It is necessary to write a calculator that receives the input xml file:

<expressions>
    <expression>
        <operation OperationType="MUL">
            <operation OperationType="SUB">
                <operation OperationType="SUM">
                    <arg>2</arg>
                    <arg>4</arg>
                </operation>
                <operation OperationType="DIV">
                    <arg>1</arg>
                    <arg>4</arg>
                </operation>
            </operation>
            <operation OperationType="SUB">
                <operation OperationType="SUM">
                    <arg>12</arg>
                    <arg>55</arg>
                </operation>
                <operation OperationType="MUL">
                    <arg>123</arg>
                    <arg>4</arg>
                </operation>
            </operation>
        </operation>
    </expression>
</expressions>

For parsing I use the dom library. I not really understand how to parse XML and perform the desired action.

Aucun commentaire:

Enregistrer un commentaire