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 7781201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:09:05+00:00 2026-06-01T19:09:05+00:00

The XML data appears like this: <?xml version=1.0 encoding=UTF-8?> <xmldata> <Orders> <OrderID>2119</OrderID> <AddressValidated>Y</AddressValidated> <Affiliate_Commissionable_Value>2.0000</Affiliate_Commissionable_Value>

  • 0

The XML data appears like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <xmldata>
      <Orders>
        <OrderID>2119</OrderID>
        <AddressValidated>Y</AddressValidated>
        <Affiliate_Commissionable_Value>2.0000</Affiliate_Commissionable_Value>
        <AuthHash>d995fd9424fb99e80f58841a0ff2340f</AuthHash>
        <AVS />
        <BillingAddress1>122 27th West</BillingAddress1>
        <BillingAddress2>Floor 11</BillingAddress2>
        <BillingCity>New York</BillingCity>
        <BillingCompanyName />
        <BillingCountry>United States</BillingCountry>
        <BillingFaxNumber />
        <BillingFirstName>Dan</BillingFirstName>
        <BillingLastName>Test</BillingLastName>
        <BillingPhoneNumber>646456777</BillingPhoneNumber>
        <BillingPostalCode>10001</BillingPostalCode>
        <BillingState>NY</BillingState>
        <CardHoldersName />
        <CC_Last4 />
        <CreditCardAuthorizationDate>3/30/2012 11:52:00 AM</CreditCardAuthorizationDate>
        <CreditCardAuthorizationNumber>MANUAL</CreditCardAuthorizationNumber>
        <CreditCardTransactionID />
        <Customer_IPAddress>184.56.49.45</Customer_IPAddress>
        <CustomerID>19</CustomerID>
        <CVV2_Response />
        <GiftWrapNote />
        <IsAGift>N</IsAGift>
        <LastModBy>7</LastModBy>
        <LastModified>3/30/2012 1:39:00 PM</LastModified>
        <Locked>Y</Locked>
        <Order_Comments>Test sale - Don't process
    Ignore statuses on this order</Order_Comments>
        <Order_Entry_System>PHONE</Order_Entry_System>
        <OrderDate>3/30/2012 11:01:00 AM</OrderDate>
        <OrderNotes />
        <OrderStatus>Ready to Ship</OrderStatus>
        <PaymentAmount>8.1600</PaymentAmount>
        <PaymentMethodID>17</PaymentMethodID>
        <PONum />
        <Processed_AutoEvents>Y</Processed_AutoEvents>
        <SalesRep_CustomerID>7</SalesRep_CustomerID>
        <SalesTax1>0.1700</SalesTax1>
        <SalesTax2>0.0000</SalesTax2>
        <SalesTax3>0.0000</SalesTax3>
        <SalesTaxRate>0</SalesTaxRate>
        <SalesTaxRate1>0.08375</SalesTaxRate1>
        <SalesTaxRate2>0</SalesTaxRate2>
        <SalesTaxRate3>0</SalesTaxRate3>
        <ShipAddress1>123 27th West</ShipAddress1>
        <ShipAddress2>Floor 1</ShipAddress2>
        <ShipCity>New York</ShipCity>
        <ShipCompanyName />
        <ShipCountry>United States</ShipCountry>
        <ShipFaxNumber />
        <ShipFirstName>Dan</ShipFirstName>
        <ShipLastName>Test</ShipLastName>
        <ShipPhoneNumber>646782342</ShipPhoneNumber>
        <Shipping_Locked>Y</Shipping_Locked>
        <ShippingMethodID>1</ShippingMethodID>
        <ShipPostalCode>10001</ShipPostalCode>
        <ShipResidential>Y</ShipResidential>
        <ShipState>NY</ShipState>
        <Stock_Priority>3</Stock_Priority>
        <Tax1_IgnoreNoTaxRules />
        <Tax1_Title>Tax (8.375%)</Tax1_Title>
        <Tax2_IgnoreNoTaxRules />
        <Tax2_IncludePrevious>0</Tax2_IncludePrevious>
        <Tax2_Title />
        <Tax3_IgnoreNoTaxRules />
        <Tax3_IncludePrevious>0</Tax3_IncludePrevious>
        <Tax3_Title />
        <Total_Payment_Authorized>0.0000</Total_Payment_Authorized>
        <Total_Payment_Received>7.0700</Total_Payment_Received>
        <TotalShippingCost>5.9900</TotalShippingCost>
        <VendorID>0</VendorID>
        <OrderDetails>
          <OrderDetailID>3374</OrderDetailID>
          <AutoDropShip>Y</AutoDropShip>
          <FreeShippingItem>Y</FreeShippingItem>
          <GiftTrakNumber>0</GiftTrakNumber>
          <GiftWrap />
          <GiftWrapCost>0.0000</GiftWrapCost>
          <GiftWrapNote />
          <IsKitID />
          <KitID />
          <Locked>Y</Locked>
          <OnOrder_Qty>0</OnOrder_Qty>
          <OptionIDs />
          <Options />
          <OrderID>2119</OrderID>
          <ProductCode>test-product</ProductCode>
          <ProductID>39200</ProductID>
          <ProductName>Test Product 1</ProductName>
          <ProductNote />
          <ProductPrice>1.0000</ProductPrice>
          <ProductWeight>1</ProductWeight>
          <QtyOnBackOrder>0</QtyOnBackOrder>
          <QtyOnHold>1</QtyOnHold>
          <QtyShipped>0</QtyShipped>
          <Quantity>1</Quantity>
          <TaxableProduct>Y</TaxableProduct>
          <TotalPrice>1.0000</TotalPrice>
          <Vendor_Price>0.0000</Vendor_Price>
          <Warehouses />
        </OrderDetails>
        <OrderDetails>
          <OrderDetailID>3386</OrderDetailID>
          <AutoDropShip />
          <FreeShippingItem>Y</FreeShippingItem>
          <GiftTrakNumber>0</GiftTrakNumber>
          <GiftWrap />
          <GiftWrapCost>0.0000</GiftWrapCost>
          <GiftWrapNote />
          <Locked>Y</Locked>
          <OnOrder_Qty>0</OnOrder_Qty>
          <Options />
          <OrderID>2119</OrderID>
          <ProductCode>test-product</ProductCode>
          <ProductID>39200</ProductID>
          <ProductName>Test Product 2</ProductName>
          <ProductNote />
          <ProductPrice>1.0000</ProductPrice>
          <ProductWeight>1</ProductWeight>
          <QtyOnBackOrder>0</QtyOnBackOrder>
          <QtyOnHold>1</QtyOnHold>
          <QtyShipped>0</QtyShipped>
          <Quantity>1</Quantity>
          <TaxableProduct>Y</TaxableProduct>
          <TotalPrice>1.0000</TotalPrice>
        </OrderDetails>
      </Orders>
      <Orders>
        <OrderID>2141</OrderID>
        <AddressValidated>Y</AddressValidated>
        <Affiliate_Commissionable_Value>1.0000</Affiliate_Commissionable_Value>
        <AuthHash>14cca8be8db44ca9943f0a6cbf592c83</AuthHash>
        <AVS />
        <BillingAddress1>122 27th West2</BillingAddress1>
        <BillingAddress2 />
        <BillingCity>New York2</BillingCity>
        <BillingCompanyName />
        <BillingCountry>United States</BillingCountry>
        <BillingFaxNumber />
        <BillingFirstName>Dan2</BillingFirstName>
        <BillingLastName>Test2</BillingLastName>
        <BillingPhoneNumber>646346322</BillingPhoneNumber>
        <BillingPostalCode>10002</BillingPostalCode>
        <BillingState>NY</BillingState>
        <CardHoldersName />
        <CC_Last4 />
        <CreditCardAuthorizationDate>3/30/2012 3:33:00 PM</CreditCardAuthorizationDate>
        <CreditCardAuthorizationNumber>MANUAL</CreditCardAuthorizationNumber>
        <CreditCardTransactionID />
        <Customer_IPAddress>56.75.23.34</Customer_IPAddress>
        <CustomerID>19</CustomerID>
        <CVV2_Response />
        <GiftWrapNote />
        <IsAGift>N</IsAGift>
        <LastModBy>7</LastModBy>
        <LastModified>3/30/2012 3:33:00 PM</LastModified>
        <Locked>Y</Locked>
        <Order_Comments>Test sale #2, don't process, ignore status.</Order_Comments>
        <Order_Entry_System>PHONE</Order_Entry_System>
        <OrderDate>3/30/2012 3:32:00 PM</OrderDate>
        <OrderNotes />
        <OrderStatus>Ready to Ship</OrderStatus>
        <PaymentAmount>7.0700</PaymentAmount>
        <PaymentMethodID>17</PaymentMethodID>
        <PONum />
        <Processed_AutoEvents>Y</Processed_AutoEvents>
        <SalesRep_CustomerID>7</SalesRep_CustomerID>
        <SalesTax1>0.0800</SalesTax1>
        <SalesTax2>0.0000</SalesTax2>
        <SalesTax3>0.0000</SalesTax3>
        <SalesTaxRate>0</SalesTaxRate>
        <SalesTaxRate1>0.08375</SalesTaxRate1>
        <SalesTaxRate2>0</SalesTaxRate2>
        <SalesTaxRate3>0</SalesTaxRate3>
        <ShipAddress1>123 27th West2</ShipAddress1>
        <ShipAddress2 />
        <ShipCity>New York2</ShipCity>
        <ShipCompanyName />
        <ShipCountry>United States</ShipCountry>
        <ShipFaxNumber />
        <ShipFirstName>Dan2</ShipFirstName>
        <ShipLastName>Test2</ShipLastName>
        <ShipPhoneNumber>6461234789</ShipPhoneNumber>
        <Shipping_Locked>Y</Shipping_Locked>
        <ShippingMethodID>1</ShippingMethodID>
        <ShipPostalCode>10002</ShipPostalCode>
        <ShipResidential>Y</ShipResidential>
        <ShipState>NY</ShipState>
        <Stock_Priority>3</Stock_Priority>
        <Tax1_IgnoreNoTaxRules />
        <Tax1_Title>Tax (8.375%)</Tax1_Title>
        <Tax2_IgnoreNoTaxRules />
        <Tax2_IncludePrevious>0</Tax2_IncludePrevious>
        <Tax2_Title />
        <Tax3_IgnoreNoTaxRules />
        <Tax3_IncludePrevious>0</Tax3_IncludePrevious>
        <Tax3_Title />
        <Total_Payment_Authorized>0.0000</Total_Payment_Authorized>
        <Total_Payment_Received>7.0700</Total_Payment_Received>
        <TotalShippingCost>5.9900</TotalShippingCost>
        <VendorID>0</VendorID>
<OrderDetails>
      <OrderDetailID>3404</OrderDetailID>
      <AutoDropShip>Y</AutoDropShip>
      <FreeShippingItem>Y</FreeShippingItem>
      <GiftTrakNumber>0</GiftTrakNumber>
      <GiftWrap />
      <GiftWrapCost>0.0000</GiftWrapCost>
      <GiftWrapNote />
      <IsKitID />
      <KitID />
      <Locked>Y</Locked>
      <OnOrder_Qty>0</OnOrder_Qty>
      <OptionIDs />
      <Options />
      <OrderID>2141</OrderID>
      <ProductCode>test-product</ProductCode>
      <ProductID>39200</ProductID>
      <ProductName>Test Product</ProductName>
      <ProductNote />
      <ProductPrice>1.0000</ProductPrice>
      <ProductWeight>1</ProductWeight>
      <QtyOnBackOrder>0</QtyOnBackOrder>
      <QtyOnHold>1</QtyOnHold>
      <QtyShipped>0</QtyShipped>
      <Quantity>1</Quantity>
      <TaxableProduct>Y</TaxableProduct>
      <TotalPrice>1.0000</TotalPrice>
      <Vendor_Price>0.0000</Vendor_Price>
      <Warehouses />
    </OrderDetails>
  </Orders>
</xmldata>

I need only the children of all <OrderDetails>

In testing I have tried to simply echo all of the data and then set variables once I had that.

function processxmldetails() {
$filexml='vl_rts.xml';
if (file_exists($filexml)) {
$xml = simplexml_load_file($filexml);
foreach ($xml->Orders->OrderDetails->children() as $Orders) {
echo $Orders . '<br>';
}
//end foreach
}
}

Which only echos this:

3374
Y
Y
0

0.0000



Y
0


2119
test-product
39200
Test Product 1

1.0000
1
0
1
0
1
Y
1.0000
0.0000

I need each <OrderDetails> really in it’s own variable so I can check which <OrderDetailID> it is and insert into another database accordingly.

How can I call on these <OrderDetail> tags one by one and then check what their <OrderDetailID> is to perform a task, then move on to the next <OrderDetail>?

  • 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-06-01T19:09:07+00:00Added an answer on June 1, 2026 at 7:09 pm

    You can use this:

    <?php
    function processxmldetails() {
        $filexml = 'vl_rts.xml';
        $data = array();
    
        if( file_exists( $filexml ) ) {
            $xml = simplexml_load_file( $filexml );
            $i = 0;
    
            foreach( $xml->Orders as $key => $orders ) {
                $j = 0;
                $data[ $i ] = array();
    
                $data[ $i ][ 'OrderID' ] = ( int ) $orders->OrderID;
                $data[ $i ][ 'OrderDetails' ] = array();
    
                foreach( $orders->OrderDetails as $key1 => $value ) {
                    foreach( $value as $k => $v ) {
                        $data[ $i ][ 'OrderDetails' ][$j][ $k ] = ( string ) $v;
                    }
                    $j++;
                }
                $i++;
            }
        }
    
        return $data;
    }
    $result = processxmldetails();
    
    foreach( $result as $key => $value ) {
        foreach( $value[ 'OrderDetails' ] as $k => $v ) {
            foreach( $v as $k1 => $v1 ) {
                echo $k1 .' = ' . $v1 . '<br />';
            }
            echo '----<br /><br />----';
        }
    }
    ?>
    

    All data within the OrderDetailID tag is now in the array. You can use it as per your requirements. Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got some XML that appears like this <Data> <MainItem> <ItemGroup>Foo</ItemGroup> <ItemDetails>Details</ItemDetails> </MainItem> <MainItem>
I'm working with XML data from an application where we get XML like this:
When I receive XML data (via a Twitter API call, in this instance), I
I'd like to insert some test xml data into a table before executing a
I will need to be able to receive this xml data from a Java
I have some xml data contained in three files (Database.xml, Participants.xml, and ConditionTokens.xml). I
My application loads an XML data set from a file on disk using serialization,
I retrieve XML data in Flex via HttpService. I have the resultFormat property on
I'm developping a xml data format. Besides other data there should be a xaml
I have an xml data file and I want to populate a listview in

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.