It looks good directly it is just in Flash:

This XML file does not appear to have any style information associated with
it. The document tree is shown below.
 
<data><project><project_code>1</project_code><project_datum>2011-07-19</proj
ect_datum><project_klant_nummer>1</project_klant_nummer><project_naam>projec
t naam 1</project_naam><project_omschrijving>project omschrijving
1</project_omschrijving><project_werkzaamheden>project
werkzh</project_werkzaamheden><project_ordernummer_klant>project ordernummer
klant 1</project_ordernummer_klant><project_contactpersoon>project Tinus
Plosteling</project_contactpersoon><project_aanneemsom>3000.00</project_aann
eemsom><project_opdracht>lopend</project_opdracht></project></data>

I will look at your suggestion now.
Due to my time zone, I had to take a beauty sleep. :-)

Best regards,
Cor 

-----Original Message-----
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Glen Pike
Sent: woensdag 20 juli 2011 16:58
To: Flash Coders List
Subject: Re: [Flashcoders] Incorrect XML from PHP to Flash

Hmm, maybe not URL encoding.

What happens when you call the php page directly - in Firefox, does it show
you the XML, or do you have to view the source?  (The former would mean
firefox considered it valid xml)

Does the XML show all the url-encoded characters, or is it just in Flash?

As an aside to help with your XML, you could do this - it might not help
your encoding, check the results by echoing them out I guess?

     //Don't worry about \n and whitespace in your $response var, the
DOMDocument will sort it out ;)
     //You don't need to include the <?xml?> tag either.
     $response = ....
     //...
     $doc = new DOMDocument();
     $doc->preserveWhiteSpace = false;
     $doc->formatOutput = true;
     $doc->loadXML($response);
     echo $doc->saveXML();


     Another trick might be to do this to make your "output" a bit more 
easy to automate:

     $fields = array("code", "datum", "klant_nummer", ...);

     while($row = mysql_fetch_assoc($result)) {
         $response .="<project>";


         foreach($fields as $field) {
             $response .= "<project_${field}><![CDATA[" .$row["project_" 
.$field] ."]]></project_${field}">;
         }

HTH

Glen

On 20/07/2011 15:39, Cor wrote:
> This is it without the DB-conection ofcourse:
>
> if (isset($_POST['sendRequest'])&&  $_POST['sendRequest'] ==
> "read_all_projects") {        
>    $sql = "SELECT * FROM tbl_projecten";
>       $result = mysql_query($sql);
>       header("Content-type: text/xml");
>       $response ='<?xml version="1.0" encoding="UTF-8" ?>';
>       $response .="\n<data>";
>    while($row = mysql_fetch_object($result)){
>               $response.='<project>';
>       
>
$response.='<project_code><![CDATA['.$row->project_code.']]></project_code>'
> ;
>       
>
$response.='<project_datum><![CDATA['.$row->project_datum.']]></project_datu
> m>';
>       
>
$response.='<project_klant_nummer><![CDATA['.$row->project_klant_nummer.']]>
> </project_klant_nummer>';
>       
>
$response.='<project_naam><![CDATA['.$row->project_naam.']]></project_naam>'
> ;
>       
>
$response.='<project_omschrijving><![CDATA['.$row->project_omschrijving.']]>
> </project_omschrijving>';
>       
>
$response.='<project_werkzaamheden><![CDATA['.$row->project_werkzaamheden.']
> ]></project_werkzaamheden>';
>       
>
$response.='<project_ordernummer_klant><![CDATA['.$row->project_ordernummer_
> klant.']]></project_ordernummer_klant>';
>       
>
$response.='<project_contactpersoon><![CDATA['.$row->project_contactpersoon.
> ']]></project_contactpersoon>';
>       
>
$response.='<project_aanneemsom><![CDATA['.$row->project_aanneemsom.']]></pr
> oject_aanneemsom>';
>       
>
$response.='<project_opdracht><![CDATA['.$row->project_opdracht.']]></projec
> t_opdracht>';
>               $response.='</project>';
>       }
>       $response.="</data>";
>       print $response;
> }
>
> Best regards,
> Cor
>
>
> -----Original Message-----
> From: flashcoders-boun...@chattyfig.figleaf.com
> [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Henrik
> Andersson
> Sent: woensdag 20 juli 2011 16:37
> To: Flash Coders List
> Subject: Re: [Flashcoders] Incorrect XML from PHP to Flash
>
> Your php code is broken then.
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to