hi thnx for ur reply..
  i tried it..

the code i use is..
  try
      {
        //  Setting a system property required by SAXON
        System.setProperty("javax.xml.parsers.DocumentBuilderFactory","com.icl.saxon.om.DocumentBuilderFactoryImpl");

        //  Create DocumentBuilderFactory 
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
     
        //  Load the specified XML document
        DocumentBuilder builder = factory.newDocumentBuilder();
        InputSource inputSrc = new InputSource
            (new FileInputStream(new File(xmlFileToLoad)));
        Document xmlDoc = builder.parse(inputSrc);
            NodeList dd=xmlDoc.getElementsByTagName("pubname");
            Node dd1=dd.item(0);
        //  Assign root node to SAXON NodeInfo, which is then used to
        //  set the current context node for XPath searches 
        NodeInfo nodeInfo = (NodeInfo) dd1;
       
       
        Context context = new Context();
        context.setContextNode(nodeInfo);
       
        //  If XML document defines namespaces, this would be the time to declare them
        //  Use StandaloneContext.declareNamespace for this purpose
       
        DocumentInfo docInfo = nodeInfo.getDocumentRoot();
        NamePool namePool = docInfo.getNamePool();
        StandaloneContext standaloneContext = new StandaloneContext(namePool);
       
        System.out.println(standaloneContext.getLineNumber());
        //  Parse the input XPath expression
        Expression expr = Expression.make(xpathExpr, standaloneContext);
       
        try
        {
            //  First, try to get a node-set, if it fails then try to
            //  evaluate XPath expression as a string result value
            NodeSetValue resultSet = expr.evaluateAsNodeSet(context);
            System.out.println("the dll "+docInfo.getLineNumber()+"    "+nodeInfo.getLineNumber()+"    "+context.getCurrentNodeInfo()); 
            //  Loop over result node-set
            NodeEnumeration enumResult = resultSet.enumerate();
           
            int countNodes = 0;
            while(enumResult.hasMoreElements())
            {
              try
              {
                  NodeInfo curResultNode = enumResult.nextElement();
                 
                  //  System.out.println("The Line Number "+curResultNode.getLineNumber());
                  String curNodeValue = curResultNode.getStringValue();
                  //  System.out.println(curNodeValue+"  "+curResultNode.getLineNumber());
                  if(curNodeValue != null && curNodeValue.length() > 0)
                    result += curNodeValue + "\n";

                  countNodes++;
              }
              catch(Exception exp)
              {
                  exp.printStackTrace();
              }
            }

            if(countNodes > 0)
            {
              if(countNodes==1)
              {
                  result += "\nOne matching node found!";
              }
              else
              {
                  result += "\n" + String.valueOf(countNodes) +
                    " matching nodes found!";
              }
            }
       
        }
        catch(XPathException exp)
        {
            result = expr.evaluateAsString(context);
        }
      }
      catch(SAXException exp)
      {
        System.out.println("'" + xmlFileToLoad + "' is NOT well-formed.\n" +
exp.toString());
      }
      catch(FactoryConfigurationError exp)
      {
        System.err.println(exp.toString());
      }
      catch(ParserConfigurationException exp)
      {
        System.err.println(exp.toString());
      }
      catch(Exception exp)
      {
        System.err.println(exp.toString());
        exp.printStackTrace();
      }
so the line number when using nodeinfo it is returning -1. why is it so?
On Tue, 04 Oct 2005 Michael Kay wrote :
>Saxon will only include line numbers in a constructed tree if you set the
>appropriate options. It depends a bit how you are building the tree. On the
>TransformerFactory you can do
>
>setAttribute(FeatureKeys.LINE_NUMBERING, Boolean.TRUE)
>
>or there are methods to set line numbering on the Configuration and Builder
>classes.
>
>Once the tree has been built to include line numbers, you can access the
>line number using the getLineNumber() method on NodeInfo.
>
>P.S. Upper case and lower case are significant in Java names, and greatly
>help readability in English too.
>
>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: 04 October 2005 04:18
>To: saxon-help@lists.sourceforge.net
>Subject: [saxon] help in getting line number..
>
>
>
>
>hi guru,
>      i am using saxon for reading a node in java.when i parse a node or
>node list i need to get the lin number of that particular node..
>how do i get i have seen te class nodeinfo has getlinenumber() option but
>still it is not working out could u help me out in getting the line number
>of a node i am reading if there is a sample code it will be more useful
>
>regards,
>ram.t
>
>
>
>
><http://adworks.rediff.com/cgi-bin/AdWorks/sigclick.cgi/www.rediff.com/signa
>ture-home.htm/1507191490@Middle5?PARTNER=3>
>