How to get the Exact Line number of an Xml Node using java dom Parser. For instance consider I have an XML Tag as .How to get the Exact Line number of this tag using DOM.
Below are my code:
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc1=dBuilder.parse(inputFile); NodeList nList3=doc1.getElementsByTagName("order-id"); //I have tried the below and It Throws compile time error System.out.println("Line Number Of order ID:"+nList3.getLineNumber(); Can Any one pls help to resolve this? Thanks in advance
No comments:
Post a Comment