xml_get_current_column_number
Get the current column number of the XML parser
xml_get_current_column_number() function returns the current column number of the XML parser.
When an error occurs, return the error description, line number, and column number of the XML parser:
<?php
// Invalid XML file
$xmlfile = 'test.xml' ;
$xmlparser = xml_parser_create ( ) ;
// Open the file and read the data
$fp = fopen ( $xmlfile , 'r' ) ;
while ( $xmldata = fread ( $fp , 4096 ) ) {
// Analyze data blocks
if ( ! xml_parse ( $xmlparser , $xmldata , feof ( $fp ) ) ) {
die ( print "ERROR: "
. xml_error_string ( xml_get_error_code ( $xmlparser ) )
. "<br>Line: "
. xml_get_current_line_number ( $xmlparser )
. "<br>Column: "
. xml_get_current_column_number ( $xmlparser )
. "<br>" ) ;
}
}
xml_parser_free ( $xmlparser ) ;
?>
The output of the above code may be:
ERROR : Mismatched tag Line : 5 Column : 41
xml_get_current_column_number ( parser )
| parameter | describe |
|---|---|
| parser | Required. Specifies the XML parser to use. |