Ver Mensaje Individual
  #2 (permalink)  
Antiguo 07/10/2013, 17:41
Avatar de andresdzphp
andresdzphp
Colaborador
 
Fecha de Ingreso: julio-2011
Ubicación: $this->Colombia;
Mensajes: 2.749
Antigüedad: 12 años, 9 meses
Puntos: 793
Respuesta: Como identificar un xml con formato cfdi o cfd, en php

Bienvenido al foro.

Si es como lo entendí, podrías hacer algo así:

Código PHP:
Ver original
  1. <?php
  2.  
  3. $sxe = new SimpleXMLElement ("tu.xml", null, true);
  4.  
  5. $namespaces = $sxe->getDocNamespaces();
  6.  
  7. if (array_key_exists('cfdi', $namespaces)) {
  8.     //funciones con cfdi
  9. } else {
  10.     //funciones sin cfdi
  11. }

http://www.php.net/manual/es/simplex...namespaces.php
__________________
Si sabemos como leer e interpretar el manual será mucho más fácil aprender PHP. En lugar de confiar en ejemplos o copiar y pegar - PHP