Jump to content

Neiopai

Members
  • Posts

    10
  • Joined

  • Last visited

Neiopai's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I change my code. now i am using strings and it works . well it print one of the invoice but i need to print all not just one . This is my code <?php $filename = 'saft_solverde_wgres_FAC2-01-2013-500272484.xml'; $xml = simplexml_load_file($filename); $p_cnt = count($xml->SourceDocuments->SalesInvoices->Invoice->InvoiceNo); for($i = 0; $i < $p_cnt; $i++) { $Invoice = $xml->SourceDocuments->SalesInvoices->Invoice->InvoiceNo[$i]; echo $Invoice; } ?> This is the what i get 01 22/20367[/size] And its right. this is the invoiceNo. [/size] How can i place it in a way that prints every invoice and not just one? [/size]
  2. Sorry for the late replay object(SimpleXMLElement)#2 (0) { } I search on google , got a few answers like this one: "This is because SimpleXML requires exact typecasting or you'll get ridiculous things happening like this - var_dump will output what you want, echo won't" But .. i dont understand what it mean or how to apply on my code i mean. i have to remove the echo and switch to one var_dump?
  3. With that code i get a white page . No error , no code , no xml , just .. white Already try to change the code in all of the things i can get and always torn up a white page.
  4. Thanks for the help ignace. after i placed your code i got this error . This page contains the following errors:error on line 1 at column 21: Extra content at the end of the document Below is a rendering of the page up to the first error. Sorry but i never worked with xml and my php knowledge is pretty basic. Thanks for all the help so far.
  5. Code: <html> <head> </head> <body > <?php print '<?xml version="1.0" encoding="windows-1252"?>'; header('Content-type: text/xml encoding="windows-1252"'); $xml = simplexml_load_file("saft_solverde_wgres_FAC2-01-2013-500272484.xml"); foreach($xml->Invoice as $Invoice) { echo $InvoiceNo->InvoiceNo; } ?> </body> </html> Error: This page contains the following errors: error on line 5 at column 6: XML declaration allowed only at the start of the document Below is a rendering of the page up to the first error. Line 5 is the "<?php" I start using notepad++ 2 days ago . still learning how to use it . but the language is set to php
  6. the encoding is windows-1252 But when i place the code you gave me and try to run the php i got: $xml = simplexml_load_file("saft_solverde_wgres_FAC2-01-2013-500272484.xml"); foreach($xml->Invoice as $Invoice) { echo $InvoiceNo->InvoiceNo; }
  7. <body > <?php header('Content-type: text/xml'); $xml = simplexml_load_file("saft_solverde_wgres_FAC2-01-2013-500272484.xml"); foreach($xml->Invoice as $Invoice) { echo $InvoiceNo->InvoiceNo; } print '<?xml version="1.0" encoding="ISO-8859-1"?>';?> </body> </html> like this? Sorry my php skills are not the best If i run this code i get : This page contains the following errors: error on line 2 at column 6: XML declaration allowed only at the start of the document Below is a rendering of the page up to the first error.
  8. This page contains the following errors: error on line 5 at column 6: XML declaration allowed only at the start of the document Below is a rendering of the page up to the first error.I get this .
  9. Hi guys . My name is Ricado Baptista i am new here and i have a problem, I got this code: <html> <head> </head> <body > <?php header('Content-type: text/xml'); $xml = simplexml_load_file("saft_solverde_wgres_FAC2-01-2013-500272484.xml"); foreach($xml->Invoice as $Invoice) { echo $InvoiceNo->InvoiceNo; } ?> </body> </html> But when i run it i go this: "This XML file does not appear to have any style information associated with it. The document tree is shown below. <html> <head></head> <body></body> </html> Why nothing is appearing? where is my error? :/
×
×
  • 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.