codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  issues with simplexml_load_string/SimpleXMLElement on PHP 5.1/Linux  crmpicco at 21:49 on Thursday, September 10, 2009
 

This works fine under WAMP with PHP 5.3 and Windows XP on my dev machine. But on a Unix/PHP 5.1 env it doesn't. I am looking to pull out "LineNumber" and "TaxAmount" from the XML for each iteration of the loop below, for each iteration "$tax_line" is always an object of simplexml_load_string ( http://us2.php.net/manual/en/functio...oad-string.php ).

$tax_line is the following object, which obviously has a type of "object".

Does anyone know how I would do this?

The point where things seem to get screwy between Windows and Linux is when I come to this line: $tax_lines = $tax_document->TaxLines->TaxLine;

The SimpleXMLElement is a print_r dump of "$tax_line".

Any help would be really appreciated. Have been looking at this for ages now!

Cheers,
Picco

[code]
SimpleXMLElement Object
(
[@attributes] => Array
(
[Id] => 1
)

[LineNumber] => 1
[TaxSummary] => SimpleXMLElement Object
(
[EffectTaxRate] => 0.09752
[TaxAmount] => 24.38
[TaxBasis] => 250.00
)
)

$response_xml = simplexml_load_string($data);
$document_status = $tax_document->DocumentStatus->Success; // this can be outputted fine
$tax_lines = $tax_document->TaxLines->TaxLine;

foreach ($tax_lines as $tax_line) {

$linenumber = (string) $tax_line[0]->LineNumber;
$taxamount = (string) $tax_line[0]->TaxSummary->TaxAmount;

}
[/code]








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: How to connect to oracle using java
•  Javascript code please
•  Re: open excel file in html page
•  Help! Z-index problem with iframe and dropdown menu
•  Re: SQL Date
•  Bar chart not displayed mozilla but displayed in firefox while implemented dynamically in c#
•  issues with simplexml_load_string/SimpleXMLElement on PHP 5.1/Linux
•  Re: blank lines
•  Re: Help: Trouble with z-Index and SELECT lists


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2009