Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/12/2009, 06:08
ernestolagomar
 
Fecha de Ingreso: junio-2009
Mensajes: 41
Antigüedad: 14 años, 10 meses
Puntos: 0
error al crear xml aunque el resultado esta bien

este es el codigo php que genera el xml. el xml se genera bien, y el resultado es correcto, pero paralelamente el navegador me abre otra ventana que me pone:

Error de lectura XML: no se encuentra elemento
Ubicación: http://localhost/_SGE/DataGRF.php?us...=CC3333,996699
Número de línea 1, columna 1:
^

repito, el resultado es correcto, crea el xml bien y funciona, pero algo hace que salte ese error, gracias por su ayuda

<?php
header('Content-Type: text/xml');
header("Cache-Control: no-cache, must-revalidate");
//A date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

include("ServerLibrary.php");

// Parametros requeridos

$sUsr = $_GET["usr"];
$sPwd = $_GET["pwd"];
$sFld = $_GET["fld"];
$sFle = $_GET["fle"];
$sTbl = $_GET["tbl"];
$sCla = $_GET["cla"];
$sTit = $_GET["tit"];
$sDsc = $_GET["dsc"];
$sCol = $_GET["col"];

$Porcentajes = array();
$sColours = explode(",", $sCol);
$NumPortions = sizeof($sColours);
$sRegionDesc = explode ("|", $sDsc);
$sRegionNames = explode (":", $sRegionDesc[0]);
$sFields = $sRegionDesc[2];


$doc = new DOMDocument();
$doc->load('ConfigDatabase.xml');

$sDB = _XMLTagValue($doc,"DATABASENAME");

_DBConnect($sUsr,$sPwd,$sDB);

$sSQL = _CreateQuery($sTbl,$sFld,$sCla);
$result = _QueryExecute($sSQL);

while ($row = mysql_fetch_row($result)) {
if ($row[$sFields] != "") {
$Porcentajes[$row[$sFields]]++;
}
}
for ($n=0; $n < $NumPortions; $n++) {
$sSum += $Porcentajes[$n];
}
for ($n=0; $n < $NumPortions; $n++) {
$Porcentajes[$n] = (($Porcentajes[$n] * 100) / $sSum);
}

//variable xml, string que se graba al final como xml

$xml='<?xml version="1.0" encoding="ISO-8859-1"?>'."\n";
$xml.='<chart>'."\n";
$xml.="<axis_category shadow='low' size='12' color='000000' alpha='50'orientation='horizontal'/>"."\n";
$xml.="<axis_ticks value_ticks='false' category_ticks='false'/>"."\n";
$xml.="<axis_value alpha='0'/>"."\n";
$xml.="<chart_border top_thickness='0'bottom_thickness='0'left_thicknes s='0'right_thickness='0'/>"."\n";
$xml.='<chart_data>'."\n";
$xml.='<row>'."\n";
$xml.='<null/>'."\n";
for ($n=0; $n < $NumPortions; $n++) {
$xml.='<string></string>'."\n";
}
$xml.='</row>'."\n";
for ($n=0; $n < $NumPortions; $n++) {
$xml.='<row>'."\n";
$xml.="<string>".$sRegionNames[$n]."</string>"."\n";
$xml.="<number>".$Porcentajes[$n]."</number>"."\n";
$xml.='</row>'."\n";
}
$xml.='</chart_data>'."\n";
$xml.="<chart_grid_h thickness='0'/>"."\n";
$xml.="<chart_label shadow='low' color='FFFFFF' alpha='100' size='10' position='over'/>"."\n";
$xml.="<chart_pref rotation_x='30' rotation_y='40' min_x='20' max_x='70' min_y='30' max_y='80'/>"."\n";
$xml.="<chart_rect x='-40' y='30' width='480' height='240' positive_alpha='0'negative_alpha='25' />"."\n";
$xml.='<chart_type>3d column</chart_type>'."\n";
$xml.='<filter>'."\n";
$xml.="<shadow id='low' distance='5' angle='45' alpha='50' blurX='2' blurY='2'/>"."\n";
$xml.='</filter>'."\n";
$xml.='<series_color>'."\n";
for ($n=0; $n < $NumPortions; $n++) {
$xml.="<color>".$sColours[$n]."</color>"."\n";
}
$xml.='</series_color>'."\n";
$xml.="<series bar_gap='10' set_gap='20' />"."\n";
$xml.='</chart>'."\n";

$file=fopen('sample.xml','w');
fwrite($file,$xml);
fclose($file);
mysql_close($con);

?>