Are there restrictions on XML rendering?

Asked

Viewed 53 times

0

I have a file of 960 records where each record has 175 fields, it’s a real estate form. When I ask to loop the 960 records with only 10 fields enabled, it generates an XML error as per photo.

inserir a descrição da imagem aqui

// Loop dos valores
for ( $i = 0; $i<count($res)-1; $i++ ) {
    $xml .= '<Imovel>';

    $xml.="<DATA>".$res[$i]["Data cadastro"]."</DATA>";
    $xml.="<ENDERECO>".$res[$i]["Endereco"]."</ENDERECO>";
    $xml.="<BAIRRO>".$res[$i]["Bairro"]."</BAIRRO>";
    $xml.="<CIDADE>".$res[$i]["Cidade"]."</CIDADE>";
    $xml.="<UF>".$res[$i]["UF"]."</UF>";
    $xml.="<EMPREENDIMENTO>".$res[$i]["Empreendimento"]."</EMPREENDIMENTO>";
    $xml.="<NUMERO>".$res[$i]["Numero"]."</NUMERO>";
    $xml.="<PLACA>".$res[$i]["Referencia"]."</PLACA>";
    $xml.="<DORMITORIO>".$res[$i]["Dormitorio"]."</DORMITORIO>";
    $xml.="<SUITE>".$res[$i]["Suite"]."</SUITE>";
    ...

Already when I make this loop just to catch the first record, it returns a XML valid. There are restrictions regarding the generation of XML or there may be an error in the data?

  • Have you thought about the possibility that the webservice parser has some limitation on the length of the line? Are you passing all the parameters according to the manual? The server has no extension for XML manipulation, such as simplexml?

  • It does not have extension to handle XML but I have found a solution: put everything inside CDATA[] and so searched all the records normally. Does CDATA[] influence the XML file generation time? You can also help me with this question: http://answall.com/questions/31718/comort-insertdatas-xml-dentro-de-um-banco-mysql

1 answer

2


There is no limitation, by error message your problem may be the presence of a & in some field.

You can try to replace all & that you have to &amp;

  • Thank you for the reply. How could I do this at runtime of the script that mounts XML?

  • 1

    I don’t really understand PHP to tell you exactly what to do, but it would basically give a replace when mounting the fields where you can have this character

  • Know of any efficient method to return exactly where the error is XML or show exactly the location of the error?

  • I ended up solving with C_DATA[].

Browser other questions tagged

You are not signed in. Login or sign up in order to post.