How to find the line number and column number in given xml

Hi friends,

I am new to xml, i have a one requirement in xml, i want to find the line number and column number of each element in given xml, i am using lib xml but lib xml find the line number and column number when start tag and end tag was mismatch or given structure was wrong,

my requirement was


when ever the data between the ‘duedate’ was missing in that case also i want line number and columnumber , for this how to write code.

please if any one tell.

Thanks and Regards


Try the free VIM text editor. All you need to do is cut and paste your code into the text editor and you can see the line and column number where your cursor is placed.

hi ekompute,

Thanks for your replay,

my requirement was i want provide a validations for given xml, if any error occur i displays the line number and column number and error, in that case i need column number and line number so for that i want used any predefined methods . if any predefined methods please tell. with out using xsd i provide this validation that is my requirement.

Thanks and Regards


Sorry swamyvnvs, I got you wrong. I remember there is a plugin for Mozilla that tells you the errors but I cannot remember the name. The error is displayed at the bottom of the screen. Wonder whether it is Tidy.

Anyway, take a look at this and see if it helps:

Hi ekompute,

Thanks for replay,

I will try and see,

Thanks and Regards

sorry ekompute,

I need php functions for finding the line number and column number for displaying the error.

Hahaha, sorry again. I guess what you need is a php debugger. If it doesn’t work, then hopefully, someone else will come to your aid.