Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6952655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:22:39+00:00 2026-05-27T14:22:39+00:00

I have been trying to get the SimpleXMLElement to extract a vsingle value fro

  • 0

I have been trying to get the SimpleXMLElement to extract a vsingle value fro an XML file using the following code per php.net examples:

$resp = new SimpleXMLElement($xml);
foreach($resp->SESSION_LIST->SESSION as $sess){
    $type = $sess->TRACKING->TYPE;
}

When I do so, the return value is always another simpleXML Object, and I am stuck as to how to get just the value I am looking for. Can someone please give me a push in the right direction?

Here is the XML string I am using. It can have multiple SESSION attributes:

$xml = <<<XML
<?xml version="1.0"?>
    <FREIGHTVIEW>
        <SESSION_LIST>
            <SESSION id="529075">
                <SESSION_ID>529075</SESSION_ID>
                <LABEL>116800</LABEL>
                <INTEGRATION_REFERENCE_NUMBER>WDLSTRFDTS</INTEGRATION_REFERENCE_NUMBER>
                <TRACKING>
                <TYPE>provider assigned</TYPE> 
                <EVENT_DATETIME>03/01/11 02:07:59 PM</EVENT_DATETIME> 
                <TIMEZONE /> 
                <USER_NAME>Dispatch Team</USER_NAME> 
                <COMPANY_NAME>M&amp;W Distribution</COMPANY_NAME> 
                <RECORDED_DATETIME>03/01/11 02:07:59 PM</RECORDED_DATETIME> 
                <SOURCE /> 
            </TRACKING> 
            <QUOTE id="5173468"> 
                <QUOTE_ID>5173468</QUOTE_ID> 
                <CARRIER type="Private"> 
                    <NAME>- FedEx Freight Priority -</NAME> 
                    <CARRIER_REFERENCE_NUMBER>FXFE</CARRIER_REFERENCE_NUMBER> 
                    <CONTACT>- FedEx Freight Priority -</CONTACT> 
                    <EMAIL /> 
                    <PHONE></PHONE> 
                </CARRIER> 
                <TOTAL_AMOUNT>262.57</TOTAL_AMOUNT> 
                <ACCESSORIALS> 
                    <ACCESSORIAL> 
                        <NAME>fuel surcharge</NAME> 
                        <AMOUNT>79.47</AMOUNT> 
                    </ACCESSORIAL>
                    <ACCESSORIAL> 
                        <NAME>delivery appointment request</NAME> 
                        <AMOUNT>0.00</AMOUNT> 
                    </ACCESSORIAL> 
                    <ACCESSORIAL> 
                        <NAME>line haul</NAME> 
                        <AMOUNT>183.10</AMOUNT> 
                    </ACCESSORIAL> 
                </ACCESSORIALS> 
                <EQUIPMENT> 
                    <MODE>ltl</MODE> 
                    <TYPE></TYPE> 
                </EQUIPMENT> 
                <PICKUP_DATE></PICKUP_DATE> 
                <ESTIMATED_DELIVERY_DATE></ESTIMATED_DELIVERY_DATE> 
                <REFERENCE_ID>37307086</REFERENCE_ID> 
                <QUOTE_GOOD_UNTIL></QUOTE_GOOD_UNTIL> 
                <QUOTE_TYPE>instant ltl</QUOTE_TYPE> 
                <COMMENTS></COMMENTS> 
                <QUOTE_STATUS>assigned</QUOTE_STATUS> 
            </QUOTE> 
        </SESSION> 
    </SESSION_LIST> 
</FREIGHTVIEW>
XML;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:22:39+00:00Added an answer on May 27, 2026 at 2:22 pm

    You need to typecast the object to a string:

    $type = (string) $sess->TRACKING->TYPE;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to get the following code working. It's a progress bar
I have been trying to get LastBootUpTime using Win32_OperatingSystem class (WMI). HRESULT hr =
I have been trying to get the currently logged-in user's token information using the
I have been trying for about a day now to get an xml feed
I have been trying to get 2,3,4 words of a file and this is
I have been trying to get my geocoder working this morning for the following
I have been trying to get the subgroup total of the data below using
I have been trying to get the URI path for an asset file. uri
Hi I have been trying to get this script http://jsbin.com/ipajo5/ working but using .live()
I am using django-voting package and have been trying to get it's manager get_top()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.