PHP xml_set_notation_decl_handler () फ़ंक्शन
❮ पीएचपी एक्सएमएल पार्सर संदर्भ
उदाहरण
एक एक्सएमएल पार्सर बनाएं, कैरेक्टर डेटा हैंडलर सेट करें, नोटेशन डिक्लेरेशन हैंडलर सेट करें और एक्सएमएल दस्तावेज़ को पार्स करें:
<?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);
?>
परिभाषा और उपयोग
xml_set_notation_decl_handler() फ़ंक्शन एक फ़ंक्शन निर्दिष्ट करता है जिसे तब कहा जाता है जब पार्सर को XML दस्तावेज़ में एक नोटेशन घोषणा मिलती है।
नोट: हैंडलर पैरामीटर एक सरणी भी हो सकता है जिसमें ऑब्जेक्ट संदर्भ और विधि का नाम होता है।
वाक्य - विन्यास
xml_set_notation_decl_handler(parser, handler)
पैरामीटर मान
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:
|
टेक्निकल डिटेल
प्रतिलाभ की मात्रा: | सफलता पर सच। विफलता पर FALSE |
---|---|
पीएचपी संस्करण: | 4.0+ |
❮ पीएचपी एक्सएमएल पार्सर संदर्भ