Foros del Web » Programando para Internet » PHP »

Me gustaria que me ayuden

Estas en el tema de Me gustaria que me ayuden en el foro de PHP en Foros del Web. no se como leer este xml <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <head> <meta forua="true" http-equiv="Cache-Control" content="no-cache"/> </head> <template> <do type="accept" ...
  #1 (permalink)  
Antiguo 17/06/2013, 20:00
 
Fecha de Ingreso: junio-2013
Mensajes: 3
Antigüedad: 10 años, 10 meses
Puntos: 0
Me gustaria que me ayuden

no se como leer este xml
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<head>
<meta forua="true" http-equiv="Cache-Control" content="no-cache"/>
</head>
<template>
<do type="accept" label="Menu">
<go href="/w/InicioRucWap.jsp" />
</do>
<do type="options" label="Back">
<prev />
</do>
</template>
<card title="Resultado" id="frstcard">
<p>
<small><b>N&#xFA;mero Ruc. </b> 10445656676 - aaaaaaaaappppppppppp <br/></small>
<small><b>Antiguo Ruc.</b><br/></small>

<small>-</small>
<br/>
<small><b>Estado.</b>ACTIVO</small><br/>

<small><strong>Agente Retenci&#xF3;n IGV.</strong>

<strong>NO</strong> -
<br/>
</small>
<small><b>Nombre Comercial.</b><br/>- </small><br/>
<small><b>Direcci&#xF3;n.</b><br/>PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP </small><br/>
<small>Situaci&#xF3;n.<b> HABIDO</b></small><br/>
<small><b>Tel&#xE9;fono(s).</b><br/>-</small><br/>
<small><b>Dependencia.</b><br/> asdasdasd/small><br/>
<small><b>Tipo.</b><br/> asdasdasdasd</small><br/>


<small><b>DNI</b> : asdasdas</small><br/>
<small><b>Fecha Nacimiento.</b> asdasdas</small><br/>

<!--
<small><b>Inicio Act.</b><br/>0173</small><br/>
<small><b>Act. Econ&#xF3;mica. </b> asdasd</small><br/>
-->
</p>
</card>
</wml>
alguien me podria ayudar
  #2 (permalink)  
Antiguo 17/06/2013, 20:11
Avatar de Italico76  
Fecha de Ingreso: abril-2007
Mensajes: 3.303
Antigüedad: 17 años
Puntos: 292
Respuesta: Me gustaria que me ayuden

De acuerdo a lo que quieras hacer hay varias herramientas, para leerlo:


Código PHP:
<?php
$xml 
= <<<XML
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<head>
<meta forua="true" http-equiv="Cache-Control" content="no-cache"/>
</head>
<template>
<do type="accept" label="Menu">
<go href="/w/InicioRucWap.jsp" /> 
</do>
<do type="options" label="Back">
<prev /> 
</do> 
</template>
<card title="Resultado" id="frstcard">
<p>
<small><b>N&#xFA;mero Ruc. </b> 10445656676 - aaaaaaaaappppppppppp <br/></small>
<small><b>Antiguo Ruc.</b><br/></small>

<small>-</small>
<br/>
<small><b>Estado.</b>ACTIVO</small><br/>

<small><strong>Agente Retenci&#xF3;n IGV.</strong>

<strong>NO</strong> -
<br/>
</small>
<small><b>Nombre Comercial.</b><br/>- </small><br/>
<small><b>Direcci&#xF3;n.</b><br/>PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP </small><br/>
<small>Situaci&#xF3;n.<b> HABIDO</b></small><br/>
<small><b>Tel&#xE9;fono(s).</b><br/>-</small><br/>
<small><b>Dependencia.</b><br/> asdasdasd/small><br/>
<small><b>Tipo.</b><br/> asdasdasdasd</small><br/>


<small><b>DNI</b> : asdasdas</small><br/>
<small><b>Fecha Nacimiento.</b> asdasdas</small><br/>

<!--
<small><b>Inicio Act.</b><br/>0173</small><br/>
<small><b>Act. Econ&#xF3;mica. </b> asdasd</small><br/>
-->
</p>
</card>
</wml> 
XML;

$xmlIterator = new SimpleXMLIterator$xml );
for( 
$xmlIterator->rewind(); $xmlIterator->valid(); $xmlIterator->next() ) {
    if(
$xmlIterator->hasChildren()) {
        
var_dump($xmlIterator->current());
    }
}
?>

Fuente: http://php.net/manual/en/simplexmlit...aschildren.php


Tambien podrias empezar asi:

Cita:
<?php
$xml = simplexml_load_file('tu_archivo.xml','SimpleXmlIte rator');
Eso te genera un array de objetos muy facil de usar
__________________
Salu2!

Última edición por Italico76; 18/06/2013 a las 00:51
  #3 (permalink)  
Antiguo 23/06/2013, 13:20
 
Fecha de Ingreso: junio-2013
Mensajes: 3
Antigüedad: 10 años, 10 meses
Puntos: 0
Respuesta: Me gustaria que me ayuden

el xml que no puedo leer esta en un servidor externo y quiero poder leerlo para aplicarlo en en algun php p en un input text
  #4 (permalink)  
Antiguo 29/06/2013, 14:51
Avatar de Italico76  
Fecha de Ingreso: abril-2007
Mensajes: 3.303
Antigüedad: 17 años
Puntos: 292
Respuesta: Me gustaria que me ayuden

Accesar debes poder accesarlo,... ya si no se deja leer... prueba con cURL ... aqui hay quienes tienen experiencia usando esas funciones
__________________
Salu2!

Etiquetas: Ninguno
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 06:13.