XML -

<?xml version='1.0' encoding='UTF-8'?> <Form name='Demo' id='DemoID' searchname='Demo' search='Demo' org='Yes' > <Field name='IdentificationNumber' datatype='String' control='InputText' length='10' search='Yes' /> <Field name='Country' datatype='String' control='InputText' length='50' search='Yes' /> </Form>

PHP -
<!DOCTYPE html> <html> <body> <?php

$xml=simplexml_load_file("Demo.xml") or die("Error: Cannot create object");

echo $xml->FIELD . "<br>";

?> </body> </html>

If you replace to print recursive then you can see structure of the generated XML object

<!DOCTYPE html>
<html>
<body>
    <pre>
<?php
$xml=simplexml_load_file("demo.xml")
        or die("Error: Cannot create object");
print_r($xml);
?>
    </pre>
</body>
</html>

do with it what you want e.g. "foreach"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.