dflow Posted June 14, 2011 Share Posted June 14, 2011 erro: XML Parsing Error: not well-formed <Description><![CDATA[The economy and basic structured in the table: Description longtext utf8_bin im using this code: <?php mysql_select_db($database_international, $international); $query_rsAll = "SELECT * FROM apartments"; $rsAll = mysql_query($query_rsAll, $international) or die(mysql_error()); $row_rsAll = mysql_fetch_assoc($rsAll); $totalRows_rsAll = mysql_num_rows($rsAll); // Send the headers header('Content-type: text/xml'); header('Pragma: public'); header('Cache-control: private'); header('Expires: -1'); ?><?php echo('<?xml version="1.0" encoding="utf-8"?>'); ?> <root> <?php if ($totalRows_rsAll > 0) { // Show if recordset not empty ?> <?php do { ?> <row> <?php foreach ($row_rsAll as $column=>$value) { ?> <<?php echo $column; ?>><![CDATA[<?php echo $row_rsAll[$column]; ?>]]></<?php echo $column; ?>> <?php } ?> </row> <?php } while ($row_rsAll = mysql_fetch_assoc($rsAll)); ?> <?php } // Show if recordset not empty ?> </root> <?php mysql_free_result($rsAll); ?> Quote Link to comment https://forums.phpfreaks.com/topic/239376-xml-parsing-error-not-well-formed-using-php/ Share on other sites More sharing options...
requinix Posted June 14, 2011 Share Posted June 14, 2011 The error might be about the uppercase 'D'. Otherwise it'd help to know what the XML is. Blanket solution: it's easier to use htmlspecialchars instead of a CDATA block. ", htmlspecialchars($value), "$column>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/239376-xml-parsing-error-not-well-formed-using-php/#findComment-1229795 Share on other sites More sharing options...
dflow Posted June 14, 2011 Author Share Posted June 14, 2011 The error might be about the uppercase 'D'. Otherwise it'd help to know what the XML is. Blanket solution: it's easier to use htmlspecialchars instead of a CDATA block. <?php $column = strtolower($column); echo "<$column>", htmlspecialchars($value), "</$column>"; ?> ok how would i create from the above code an internal node for the image gallery? i have the gallery in the images table :id, imageURL LEFT JOIN images on apartments.ID = images.id WHERE apartments.id=35200 ? <apartment> <images> <image> </image> <images> </apartment> Quote Link to comment https://forums.phpfreaks.com/topic/239376-xml-parsing-error-not-well-formed-using-php/#findComment-1229801 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.