PHP xml_get_current_column_number() Function

In this chapter you will learn:

  1. Description for PHP xml_get_current_column_number() Function
  2. Syntax for PHP xml_get_current_column_number() Function
  3. Parameter for PHP xml_get_current_column_number() Function
  4. Return for PHP xml_get_current_column_number() Function
  5. Example - gets the current column number for an XML parser

Description

The xml_get_current_column_number() function gets the current column number for an XML parser.

Syntax

xml_get_current_column_number(parser)

Parameter

Parameteris RequiredDescription
parserRequired.XML parser to use

Return

This function returns the current column number on success, or FALSE on failure.

Example

Gets the current column number for an XML parser

Content for test.xml


<data>
   <missEndTag>
</data>

<?php/*j  a  v a 2 s. com*/

$xmlparser = xml_parser_create();

$fp = fopen('test.xml', 'r');
while ($xmldata = fread($fp, 1024)){
  if (!xml_parse($xmlparser,$xmldata,feof($fp))){
    print "ERROR: ";
    print xml_error_string(xml_get_error_code($xmlparser));
    print "\n";
    print "Line: ";
    print xml_get_current_line_number($xmlparser);
    print "\n";
    print "Column: ";
    print xml_get_current_column_number($xmlparser);
    print "\n";
  }
}

xml_parser_free($xmlparser);
?>

Next chapter...

What you will learn in the next chapter:

  1. Description for PHP xml_get_current_line_number() Function
  2. Syntax for PHP xml_get_current_line_number() Function
  3. Parameter for PHP xml_get_current_line_number() Function
  4. Return for PHP xml_get_current_line_number() Function
  5. Example - gets the current line number for an XML parser