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

The Archive Base Latest Questions

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

The XML, I have: <?xml version=1.0 encoding=windows-1252 ?> – <Tables> – <Table name=I_BOOKING> –

  • 0

The XML, I have:

<?xml version="1.0" encoding="windows-1252" ?> 
    - <Tables>
        - <Table name="I_BOOKING">
            - <Row action="UPDATE" success="Y">
              <Field name="AUTOBOOK">888800</Field> 
              <Field name="TOUROP">01</Field> 
              <Field name="REFERENCE">GSDFFD</Field> 
              <Field name="NBPAX">2</Field> 
              <Field name="NBINF">1</Field> 
              </Row>
      </Table>
      - <Table name="I_EXCDATERESA">
          - <Row action="UPDATE" success="Y">
               <Field name="EXCURS">KNO</Field> 
               <Field name="DATE">2012-04-12</Field> 
               <Field name="BOOKNR">125445</Field> 
               <Field name="NAME">TEST 12/4</Field> 
               <Field name="PICKUPTIME">00:00:00</Field> 
           </Row>
         - <Row action="UPDATE" success="Y">
               <Field name="EXCURS">KNO</Field> 
               <Field name="DATE">2012-04-13</Field> 
               <Field name="BOOKNR">14574575</Field> 
               <Field name="NAME">TEST 13/4</Field> 
               <Field name="PICKUPTIME">00:00:00</Field> 
          </Row>
       </Table>
    </Tables>

When I treat the table I_EXCDATERESA, I need to get the value of Field BOOKNR, so 125445 or 14574575 in this example, according to the row I am dealing with and load it in $autobook:

...

$simplexml = simplexml_import_dom($dom);

foreach ($simplexml->Table as $value)
{
    $tableName = $value->attributes()->name;
    foreach ($value->Row as $value)
    {
        if ($tableName == 'I_EXCDATERESA')
        {
            if ($value->Field->attributes()->name == 'BOOKNR')
            {
            $autoBook = $value->Field; 

This is not working, $autobook is not loaded, as it is not on the first ‘Field’ but on the third

  • 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:04:49+00:00Added an answer on June 1, 2026 at 7:04 pm

    Test this, it worked for me:

    foreach ($simplexml->Table as $value)
    {
        $tableName = $value->attributes()->name;
        foreach ($value->Row as $value_1)
        {
            if ($tableName == 'I_EXCDATERESA')
            {
                foreach ($value_1->Field as $value_2)
                {
                    if ($value_2->attributes()->name == 'BOOKNR')
                    {
                        $autoBook = $value_2[0];
                        echo $autoBook;
                    }
                }
            }
        }
    }
    

    Your problem is with:

     $value->Field->attributes()->name=='BOOKNR'
    

    That’s too much: I added another cycle on each field of elemts Row!

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

Sidebar

Related Questions

I have a xml like below. Source XML: <?xml version=1.0 encoding=Windows-1252?> <XML> <Attributes> <Attribute>
I have a code with XML output as <?xml version=1.0 encoding=windows-1252 standalone=yes?> <products> <product>
I have the following simple XSL style sheet: <?xml version=1.0 encoding=windows-1252?> <xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform xmlns=http://www.w3.org/1999/xhtml
I have an XML file that looks like <?xml version='1.0' encoding='UTF-8'?> <root> <node name=foo1
I want to make a xml file like: <?xml version=1.0 encoding=Windows-1252 ?> <settings> <typeofsetting>
I have the following xsl <?xml version=1.0 encoding=windows-1251?> <xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform> <xsl:param name=currentPage>Buildings</xsl:param> <xsl:template
I have the following simplified XML: <?xml version="1.0" encoding="UTF-8" ?> <MATMAS05> <IDOC BEGIN="1"> <E1MARAM
I have the following simplified XML structure: <?xml version="1.0" encoding="UTF-8" ?> <INVOIC02> <IDOC BEGIN="1">
I have this XML at http://localhost/file.xml : <?xml version=1.0 encoding=utf-8?> <val:Root xmlns:val=http://www.hw-group.com/XMLSchema/ste/values.xsd> <Agent> <Version>2.0.3</Version>
I have the following XML <?xml version=1.0 encoding=ISO-8859-1 ?> - <DEVICEMESSAGES> <VERSION xml=1 checksum=

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.