Jump to content

Code outputting odd XML


Go to solution Solved by Ch0cu3r,

Recommended Posts

  1. So here is the code: About 99% of the time it returns the XML listed under "Good Return" but almost randomly it is returning the code under "Bad Return". I echoed out all of the $ToID's and there is no weirdness (Only long integers)

  2.  

foreach ($xml->result->Accounts->row as $a) {

 

$ToID = (String) $a->FL[0];

$FromData = (String) $a->FL[1];

$ToXML .= '<row no="' . $UpdateCount . '">';

$ToXML .= '<FL val="Id">' . $ToID . '</FL>';

$ToXML .= '<FL val="' . $ToField . '">' . $this->FixID($FromData) . '</FL>';

$ToXML .= "</row>";

$UpdateCount+=1;

$TotalUpdateCount+=1;

echo "$ToID <br>"; //For debugging

}

 

---- Bad Return (Its missing a < after ID)

 

<row no="162">

<FL val="Id">1058030000000072643/FL><FL val="MemberCode">Firms.338</FL>

</row>

---- End bad return

 

---- Good Return

<row no="163">

<FL val="Id">1058030000000072642</FL>

<FL val="MemberCode">Firms.337</FL>

</row>

---- End good return

Link to comment
https://forums.phpfreaks.com/topic/285557-code-outputting-odd-xml/
Share on other sites

  • Solution

There is nothing wrong here with the XML syntax

$ToXML .= '<row no="' . $UpdateCount . '">';
$ToXML .= '<FL val="Id">' . $ToID . '</FL>';
$ToXML .= '<FL val="' . $ToField . '">' . $this->FixID($FromData) . '</FL>';
$ToXML .= "</row>";

Where is $ToXML passed to next? The next process could be screwing with the XML structure.

Edited by Ch0cu3r
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.