Jump to content

Help with SimpleXML


jimneely

Recommended Posts

Okay I am new to this so bare with me. I have been trying to suck in a XML file and echo out it's attributes.  Here is a example PHP code I am trying to use to do this. I need direction on how to make this work. PLEASE!

 

<?php

$xml=simplexml_load_file("Jim.xml");

echo $xml->MachineData->['timeStamp'] . "<br>";

echo $xml->MachineData[0]->['machineID'] . "<br>";

echo $xml->MachineData[0]->['lineID'] . "<br>";

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

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

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

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

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

?>

 

 

 

Jim.xml

Link to comment
Share on other sites

How you can figure this stuff out on your own in the future:

 

 

<?php
$xml = simplexml_load_file('Jim.xml');
// Check out the contents
print_r($xml);
?>

 

 

SimpleXMLElement Object
(
    [@attributes] => Array
        (
            [timeStamp] => 2014-02-04T23:59:52
            [machineID] => TM-N158
            [lineID] => M200
        )

    [TrackingData] => SimpleXMLElement Object
        (
            [@attributes] => Array
                (
                    [stationName] => HousingHeight
                    [partNumber] => 3051006070
                    [modelNumber] =>
                    [serialNumber] => 14BMJ03570
                    [LotNumber] => 879066
                )

            [KanbanNo] => 0
            [Data] => SimpleXMLElement Object
                (
                )

        )

)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.