Re: [xml] Problem parsing a string

Hi Juan:

        This is the right behaviour, since XML specs says that
spaces and newlines matters as element content.
        What you have to do is to get the next <Message> element
child, which is <ResponsePingATM>, doing:

  res = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
  res += "<Message>\n";
  res += "<ResponsePingATM Type=\"Status\" Order=\"1\"
 PhoneNumber=\"899999999\" Response=\"1\">\n";
  res += "</ResponsePingATM>\n";
  res += "</Message>";/

 doc = xmlParseMemory( res.c_str(), res.length());
 cur = xmlDocGetRootElement(doc);
     ** cur->name is Message
 cur = cur->xmlChildrenNode;
     ** cur->name is *text*
        cur->name should be ResponsePingATM

hope it helps :)


Lucas Brasilino
brasilino recife pe gov br
Emprel -        Empresa Municipal de Informatica (pt_BR)
                Municipal Computing Enterprise (en_US)
Recife - Pernambuco - Brasil
Fone: +55-81-34167078

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]