I'm afraid I've reached the end of the line on this one. When something works in my own environment and doesn't work in yours, I have little choice but to invoke the clause in the terms and conditions that says "no support". Sorry about that.
 
Michael Kay


From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of RamKumarDinesh Thillai
Sent: 10 October 2005 04:27
To: saxon-help@lists.sourceforge.net
Subject: Re: RE: Re: [saxon] Problem with line-numbers


yeah i tried this same code.

  but still i am getting the same -1 for all the elements.
i got the version as
  "Saxon Version SAXON 8.5.1 from Saxonica"
as u have asked me to try.and i am running my code from NetBeans. jdk1.5. i am using it. i have tried to run a sample xml file
called customer.xml.
<?xml version="1.0" encoding="UTF-8"?>
<Customers>
     <Customer id="C1">
          <Name>XYZ Plumbing</Name>
          <City>New Haven</City>
          <State>CT</State>
     </Customer>
     <Customer id="C2">
          <Name>Joes Bar and Grill</Name>
          <City>Waterbury</City>
          <State>CT</State>
     </Customer>
</Customers>

for this also it returns -1 for all the element.

and i am sorry for Michael abt the spelling.

On Mon, 10 Oct 2005 Michael Kay wrote :
>I can't see what you're doing wrong, but when I run this code:
>
>    public static void main(String[] args) throws Exception {
>        Configuration config = new Configuration();
>        config.setLineNumbering(true);
>        XPathEvaluator xpath = new
>net.sf.saxon.xpath.XPathEvaluator(config);
>        NodeInfo doca = xpath.setSource(new StreamSource((new
>File(args[0]))));
>        List list = xpath.evaluate("//*");
>        for (int i=0; i<list.size(); i++) {
>            NodeInfo element = (NodeInfo)list.get(i);
>            System.out.println("Element " + element.getDisplayName() + " at
>line " + element.getLineNumber());
>        }
>    }
>
>with the standard books.xml file supplied as args[0], the output looks like
>this:
>
>Element BOOKLIST at line 4
>Element BOOKS at line 5
>Element ITEM at line 6
>Element TITLE at line 7
>Element AUTHOR at line 8
>Element PUBLISHER at line 9
>Element PUB-DATE at line 10....
>
>
>The only thing I can think of is that you're using an XML parser that
>doesn't report line numbers; but I've
>never come across that problem (and Saxon relies on the line numbers for
>reporting errors in stylesheets,
>so it would be very noticeable).
>
>Could you confirm you are using Saxon 8.5.1 - do
>
>    System.out.println("Saxon Version " +
>net.sf.saxon.Version.getProductTitle());
>
>Perhaps you could send me a complete standalone program that demonstrates
>the problem, with full details of the environment in which you are running
>it.
>
>By the way, my name is Michael - capital M, and the "a" comes before the
>"e". And it's helpful to use a subject line that enables people to recognize
>whether the thread is relevant to them.
>
>Michael Kay
>http://www.saxonica.com/
>
>
>  _____
>
> From: saxon-help-admin@lists.sourceforge.net
>[mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of RamKumarDinesh
>Thillai
>Sent: 08 October 2005 05:28
>To: saxon-help@lists.sourceforge.net
>Subject: Re: Re: [saxon] ok micheal
>
>
>
>  i tried this code for my testing purpose
>            Configuration config = new Configuration();
>            config.setLineNumbering(true);
>            XPathEvaluator xpath = new XPathEvaluator(config);
>            NodeInfo doca = xpath.setSource(new StreamSource((new
>File(xmlFileToLoad))));
>            List list = xpath.evaluate("//*");
>            for (int i=0; i<list.size(); i++) {
>                NodeInfo element = (NodeInfo)list.get(i);
>                if((element.getDisplayName().equals("emph")) &&
>!element.hasChildNodes())
>                System.out.println("Element " + element.getDisplayName() + "
>at line " + element.getLineNumber());
>            }
>
>here i am checking for any empty emph element is there.
>
>it is there but the result i got through this is
>"Element emph at line -1"
>
>I hope u got my problem.dont you?
>
>
>On Sat, 08 Oct 2005 RamKumarDinesh Thillai wrote :
> >i used this code,
> >  Configuration config = new Configuration();
> >            config.setLineNumbering(true);
> >
> >
> >            XPathEvaluator xpath = new XPathEvaluator(config);
> >            NodeInfo doca = xpath.setSource(new StreamSource((new
>File(xmlFileToLoad))));
> >            // String expression = "//artfront/artinfo/pubinfo/pubname";
> >            List list = xpath.evaluate("//*");
> >            for (int i=0; i<list.size(); i++) {
> >                NodeInfo element = (NodeInfo)list.get(i);
> >                System.out.println("Element " + element.getDisplayName() +
>" at line " + element.getLineNumber());
> >            }
> >
> >it reads all the node and gives line number as -1 to all? :(:(
> >i dont know where i am going wrong..
> >
> >On Sat, 08 Oct 2005 RamKumarDinesh Thillai wrote :
> > >
> > >which one to use for parsing a document?
> > >i used this
> >
> >System.setProperty("javax.xml.parsers.DocumentBuilderFactory","net.sf.saxon
>.dom.DocumentBuilderFactoryImpl");
> > >
> > >but still it has the problem.is there anyother way to use dom so that it
>can be done to get the line number?
>
>
>
>
>
><http://adworks.rediff.com/cgi-bin/AdWorks/sigclick.cgi/www.rediff.com/signa
>ture-home.htm/1507191490@Middle5?PARTNER=3>
>