The xml_get_current_column_number() function gets the current column number for an XML parser.
xml_get_current_column_number(parser)
Parameter | is Required | Description |
---|---|---|
parser | Required. | XML parser to use |
This function returns the current column number on success, or FALSE on failure.
Gets the current column number for an XML parser
Content for test.xml
<data> <missEndTag> </data>
<?php//www .jav a2 s. co m
$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);
?>