php - How to use xml_parse_into_struct() -


i have trying use xml_parse_into_struct(), returning false

my code looks

$p = xml_parser_create(); if (xml_parse_into_struct($p,$contenido,$vals, $index)) {     print_r($vals); } 

the content of variable

$contenido looks

<saltest31>     <anuncio1>         <id>12346</id>         <titulo> bd authority</titulo>         <descripcion>preciosa casa en jardines de las animas, en xalapa veracruz. 550 m2 de terreno la mayoria jardin con arboles frutales, amplias recamaras, cocina, salon de juegos, terraza y palapa cvica123</descripcion>         <fecha>11/12/2014 10:27:15</fecha>         <municipio>chalchuapa</municipio>         <moneda>peso</moneda>         <construccion>500</construccion>         <terreno>550</terreno>         <habitaciones>5</habitaciones>         <banos>4</banos>         <imagenes>                 <total>10</total>                 <idimage>5567</imagen_url>                 <idimage>5568</imagen_url>                 <idimage>5569</imagen_url>                 <idimage>5570</imagen_url>                 <idimage>5571</imagen_url>         </imagenes>     </anuncio> </saltest3> 

my problem if statement not returning true , idea going wrong

thanks in advance

it because have many mis-matched tags in xml starting right @ top <saltest31>...</saltest3>. cause 0 returned.

in addition xml_parse_into_struct() returns 1 or 0 shouldn't mistaken true , false. docs,

xml_parse_into_struct() returns 0 failure , 1 success. not same false , true, careful operators such ===.

given that, should perform test explicitly:

$p = xml_parser_create(); if (xml_parse_into_struct($p,$contenido,$vals, $index) == 1) {     print_r($vals); } 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -