Esercitazione PHP

PHP HOME Introduzione a PHP Installazione PHP Sintassi PHP Commenti PHP Variabili PHP PHP Eco/Stampa Tipi di dati PHP Stringhe PHP Numeri PHP PHP matematica Costanti PHP Operatori PHP PHP Se...Altro...Altro Passaggio PHP Ciclo PHP Funzioni PHP Matrici PHP Superglobali PHP RegEx PHP

Moduli PHP

Gestione dei moduli PHP Convalida del modulo PHP Modulo PHP richiesto URL/e-mail del modulo PHP Modulo PHP completo

PHP avanzato

Data e ora PHP PHP Include Gestione dei file PHP Apri/Leggi file PHP Creazione/scrittura di file PHP Caricamento file PHP Cookie PHP Sessioni PHP Filtri PHP Filtri PHP avanzati Funzioni di callback PHP PHP JSON Eccezioni PHP

PHP OOP

PHP Che cos'è OOP Classi/Oggetti PHP Costruttore PHP PHP distruttore Modificatori di accesso PHP Ereditarietà PHP Costanti PHP Classi astratte PHP Interfacce PHP Tratti PHP Metodi statici PHP Proprietà statiche PHP Spazi dei nomi PHP Iterabili PHP

Database MySQL

Database MySQL MySQL Connect MySQL Crea DB MySQL Crea tabella Dati di inserimento MySQL MySQL Ottieni l'ultimo ID MySQL inserisce più MySQL preparato MySQL Seleziona dati MySQL dove MySQL Ordina per MySQL Elimina dati Dati di aggiornamento MySQL Dati limite MySQL

PHP XML

Parser XML PHP Analizzatore PHP SimpleXML PHP SimpleXML - Ottieni PHP XML espatriato PHP XML DOM

PHP - AJAX

Introduzione all'Ajax AJAX PHP Database AJAX XML AJAX Ricerca in tempo reale AJAX Sondaggio AJAX

Esempi PHP

Esempi PHP compilatore PHP Quiz PHP Esercizi PHP Certificato PHP

Riferimento PHP

Panoramica di PHP matrice PHP Calendario PHP Data PHP Directory PHP Errore PHP Eccezione PHP File system PHP Filtro PHP PHP FTP PHP JSON Parole chiave PHP PHP Libxml Posta PHP PHP matematica PHP Varie PHP MySQLi Rete PHP Controllo dell'output PHP RegEx PHP PHP SimpleXML Flusso PHP Stringa PHP Gestione delle variabili PHP Analizzatore XML PHP Zip PHP Fuso orario PHP

PHP xml_set_unparsed_entity_decl_handler() Funzione

❮ Riferimento al parser XML PHP

Esempio

Crea un parser XML, imposta il gestore dei dati dei caratteri, imposta il gestore della dichiarazione di entità non analizzata e analizza un documento XML:

<?php
$parser=xml_parser_create();

function char($parser,$data) {
  echo $data;
}

function unparsed_ent_handler($parser,$entname,$base,$sysID,$pubID,$notname) {
  print "$entname<br>";
  print "$sysID<br>";
  print "$pubID<br>";
  print "$notname<br>";
}

xml_set_character_data_handler($parser,"char");
// Set up unparsed entity declaration handler
xml_set_unparsed_entity_decl_handler($parser,"unparsed_ent_handler");

$fp=fopen("test.xml","r");

while ($data=fread($fp,4096)) {
  xml_parse($parser,$data,feof($fp)) or
  die (sprintf("XML Error: %s at line %d",
  xml_error_string(xml_get_error_code($parser)),
  xml_get_current_line_number($parser)));
}
xml_parser_free($parser);
fclose($fp);
?>


Definizione e utilizzo

La funzione xml_set_unparsed_entity_decl_handler() specifica una funzione da chiamare quando analizza un'entità non analizzata nel documento XML.

Nota: il parametro handler può anche essere una matrice contenente un riferimento a un oggetto e un nome di metodo.

Sintassi

xml_set_unparsed_entity_decl_handler(parser, handler)

Valori dei parametri

Parameter Description
parser Required. Specifies the XML parser to use
handler Required. Specifies a function to be called if the XML parser encounters an external entity declaration with an NDATA declaration. The function must accept six parameters:
  • $parser - A variable containing the XML parser calling the handler
  • $entity_name - A variable containing the name of the entity
  • $base - The base for resolving the system identifier (system_id) of the external entity. Currently, this is always an empty string
  • $system_id - The system identifier of the external entity
  • $public_id - The public identifier of the external entity
  • $notation_name - The name of the notation of this entity


Dettagli tecnici

Valore di ritorno: VERO sul successo. FALSO in caso di fallimento
Versione PHP: 4.0+

❮ Riferimento al parser XML PHP