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_notation_decl_handler() Funzione

❮ Riferimento al parser XML PHP

Esempio

Crea un parser XML, imposta il gestore dati dei caratteri, imposta il gestore della dichiarazione di notazione e analizza un documento XML:

<?php
// Create an XML parser
$parser=xml_parser_create();

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

function not_decl_handler($parser,$not,$base,$sysID,$pubID)  {
echo "$not<br>";
echo "$sysID<br>";
echo "$pubID<br>";
}

// Set the character data handler
xml_set_character_data_handler($parser,"char");

// Set the notation declaration handler
xml_set_notation_decl_handler($parser, "not_decl_handler");

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

while ($data=fread($fp,4096)) {
  // Parse XML data
  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_notation_decl_handler() specifica una funzione da chiamare quando il parser trova una dichiarazione di notazione 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_notation_decl_handler(parser, handler)

Valori dei parametri

Parameter Description
parser Required. Specifies the XML parser to use
handler Required. Specifies a function to be used as an event handler. The function must accept five parameters:
  • $parser - A variable containing the XML parser calling the handler
  • $name - A variable containing the name of the notation
  • $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 notation declaration
  • $public_id - The public identifier of the external notation declaration


Dettagli tecnici

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

❮ Riferimento al parser XML PHP