Htaccess    html   Php    javascript   Asp   css    maths  Past Questions  Practice Tests Online

libxml get errors function syntax tag tutorial 2013 Donate at flattr Flattr this





Alert! Connect with 10,000 Chating Online. Join Now

Php libxml get errors () function

Write your php code

 
<?php ?>

Php Result


Your code below



(no version information, might be only in CVS)

libxml_get_errors --  Retrieve array of errors

Syntax

array libxml_get_errors ( void )

Retrieve array of errors.

Return Values

Returns an array with LibXMLError objects if there are any errors in the buffer, or an empty array otherwise.

Examples

Example 1. A libxml_get_errors() example

This example demonstrates how to build a simple libxml error handler.

<?php

libxml_use_internal_errors
(true);

$xmlstr = <<< XML
<?xml version='1.0' standalone='yes'?>
<movies>
<movie>
  <titles>PHP: Behind the Parser</title>
</movie>
</movies>
XML;

$doc = simplexml_load_string($xmlstr);

if (!
$doc) {
    
$errors = libxml_get_errors();

    foreach (
$errors as $error) {
        echo
display_xml_error($error);
    }

    
libxml_clear_errors();
}


function
display_xml_error($error) {

    switch (
$error->level) {
        case
LIBXML_ERR_WARNING:
            
$return = "Warning $error->code: ";
            break;
         case
LIBXML_ERR_ERROR:
            
$return = "Error $error->code: ";
            break;
        case
LIBXML_ERR_FATAL:
            
$return = "Fatal Error $error->code: ";
            break;
    }

    
$return .= trim($error->message) .
               
"\n  Line: $error->line" .
               
"\n  Column: $error->column";

    if (
$error->file) {
        
$return .= "\n  File: $error->file";
    }

    return
"$return\n";
}

?>

The above example will output:

Fatal Error 76: Opening and ending tag mismatch: titles line 4 and title
  Line: 4
  Column: 0

Php libxml get errors Function syntax tag

libxml get errors php code on this is provided for your study purpose, it will guide you to know how create and design a website using php. use it to practice and train your self online



Php libxml get errors syntax tutorial

php tutorial guide and code design are for easy learning and programming. The code practice section provided at the top is for practising of this syntax. Use the code section up to practice your php programming online. Learning php is very easy, all you need is to use the examples on this site and practice them to perfect your skills.


Function index

Variables

Expressions

Operators

Control-Structures

Cookies

Array

Date & Time

Directory function

File

Image

Operators

Form data handling

Mathematics operators

Mail

Php Mysql

Network Functions

Strings

php tutorial guides,functions, classes, code examples and tags for creating simple dynamic site to mysql database driven sites
 
 
Htaccess    html   Php    javascript   Asp   css    maths  Past Questions  Practice Tests Online