Getting line number of  XML document

Hi all,
Can someone please help me in 'how to get the line number of XML document'. I know when it throws SAXParseException it give the line number. I want to get the line number when it parses the document successfully. I know i need to use setDocumentLocator and then implement the Locator.
can someone give me a chunk of code for it.
thx in advance,
-Soni

Hi,
Atlast i got the solution. It goes like this..
class A {
Location loc;
public void setDocumentLocator(Locator l) {
loc = l;
//Here goes other methods like startElement, endElement etc.
public void someMethod() {
loc.getLineNumber(); //u can do this anywhere inside the class
-Soni

Similar Messages

  • To get line number for xml file.

    how do u get th line number of a particular node i parse.
    is it possible only when error comes the line number and mesage can be displayed.
    is it possible when i use xpath expression for a particular node and if that xpath returns boolean false then can i get the line number where the node present..??
    plz reply..

    There are java classes that will give you the line number of records from files you are reading. Names begin with Line...

  • How use locator with sax to get line number of an element?

    dear friends,
    it's clearly stated in subject. after trying for hours, i still couldn't figure out how to get line numbers. my class extends defaulthandler. please help.
    ozgur

    hi
    i am also struggling with same problem
    someone plssssssss help.....
    how can i use Locator to get line number of the XML document.
    in my extended DefaultHandler class i have just implemented this,
    public void setDocumentLocator(Locator location) {
         lineNumber = location.getLineNumber();
    but no help...
    how to register my parser to the documnet locator events?
    plzzzzzzz help...
    -Soni

  • How to get Line Number in Purchase Order

    Hi Experts
    I want to get Line Number of Matrix of Purchase Order. How I get it ?
    I want to compare Matrix Line Number with Line Number of POR1 in DB.
    Please Help me.
    Hepil Doshi

    Hi Hepil,
    Linenum in Matrix "38" is Columns.Item("110").Value
    SBO application doesnot show it, but you can get the linenum from that column.
    You can test by getting the column title. omatrix.columns.item("110").Title
    Hope it helps.
    Regards
    Edy

  • Get line number error

    Hi
    Is there some way to get line number error when there is some exception ?
    I use oracle 9.2.02
    thank you in advance

    sybrand_b wrote:
    When you trap the exception you need to use dbms_utility.format_error_stack.
    Thid will not provide correct line numbers. This issue has been resolved in 10g or 11g, and 9iR2 is going completely out of support in July.FORMAT_ERROR_STACK will not provide any line numbers:
    SQL> select * from v$version
      2  /
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE    11.1.0.6.0      Production
    TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production
    SQL> set serveroutput on format word_wrapped
    SQL> begin
      2      raise no_data_found;
      3    exception
      4      when no_data_found
      5        then
      6          dbms_output.put_line('ERROR_STACK: ' || DBMS_UTILITY.FORMAT_ERROR_STACK);
      7          dbms_output.put_line('ERROR_BACKTRACE: ' || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE);
      8  end;
      9  /
    ERROR_STACK: ORA-01403: no data found
    ERROR_BACKTRACE: ORA-06512: at line 2
    PL/SQL procedure successfully completed.
    SQL>  SY.

  • How to get the number of created document?

    Hi all,
    My first program in ABAP works very well. Thanks to all who helped me
    I would like only one function to it.
    The program read data from excel file and generates document using BDC. 
    I use this statement:
    call transaction 'F-65' using bdcdatafile
    I count the number of documents which have been generated or refeused because of error using the sy-subrc function.
    if sy-subrc <> 0.
        counter for errors
    else.
        counter for generated documents
    endif.
    Finally program displays these number on the last screen and the user knows if there everything is ok. For example this is a sample screen:
    1. OK.
    2. OK.
    3. Error.
    Number of imported documents (2)
    Errors (1)
    However, I would like to add one information to these screen. If the document is saved it gets its own number.
    Is any possibility to get this number for displaying?
    Maybe there is a function which returns this number.
    I want to get the scren like this:
    1. OK. Document No. 10000001
    2. OK. Document No. 10000002
    3. Error
    Best regards
    Arek

    The document number should be being passed back via a message.  You need to specifiy to return any messages in the messtab when calling the transaction.
    DATA: MESSTAB type table of BDCMSGCOLL WITH HEADER LINE.
    call transaction 'F-65' using bdcdatafile
                            messages into messtab.
    Messtab will have the messages after the call, you can then read this internal table and check for the success message, usually the document number is in the first variable field, MSGV1.
    Regards,
    Rich Heilman

  • User-Exit - MIGO How to get the Number of Material Document

    Hi everyone!!
    I'm looking for an user-exit after saving in MIGO transaction. I need the Number of Material Document (MKPF-MBLNR) to generate an IDOC.
    Does anybody knows an user-exit to get this number?
    Regards,
    Rubens Kumori
    Edited by: Rubens  Kumori on Oct 20, 2008 3:26 PM

    In BADI definition [MB_DOCUMENT_BADI|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=mb_document_badi&adv=false&sortby=cm_rnd_rankvalue], you may use interfaces [MB_DOCUMENT_BEFORE_UPDATE|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=mb_document_badiMB_DOCUMENT_BEFORE_UPDATE&adv=false&sortby=cm_rnd_rankvalue] (before update task) and [MB_DOCUMENT_UPDATE|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=mb_document_badiMB_DOCUMENT_UPDATE&adv=false&sortby=cm_rnd_rankvalue] (in update task)
    Regards

  • Carriage Returns & Line Feeds in XML documents

    Does anyone know why the PL/SQL XML parser will NOT work with Carriage Returns (0x0D) within the XML document?
    Currently I'm having to strip them out, leaving just the Line Feed (0x0A).
    I only realised this after looking at the family.xml example document.
    T.I.A.
    Geoff

    I forgot to mention that I'm running Oracle 8i on Windows NT.

  • OSB: How to get stored in sbconsole xml document in message flow

    Hi
    I created a xml document (say ram.xml) as a XML document utility resource in OSB sbconsole.
    I want to refer this in message flow with fn:doc. Unlike xquery i can't assign ram.xml to a variable.
    I tried fn:doc("/home/osbuser/user_projects/domains/domain_name/osb/config/core/ram.xml") and fn:doc("file:////home/osbuser/user_projects/domains/domain_name/osb/config/core/ram.xml") it didn't work!
    I know if i store this xml as a xquery, it will get assigned to a variable. But i am just curious to see how fn:doc works!
    Any light !

    The reason for this is to eliminitate each assign action for each of XMLs that I use. Each assign gets converted into a xml bean and thats overhead.
    If this fn:doc() works, what i am planning is to use fn:doc() inside my xquery transformations directly, without using assign action to load XML.
    Also message flow will become somewhat cleaner.
    fn:doc() has to be used in a way that it uses relative path to access xml and not complete path (starting from /home/user_doamains/..) because development and production environment domain names are different. Using relative path, code can migrate without any change across environments.

  • How to get line number in JAVA code?

    Hi,
    What method can I use to return the current line number of my coding?
    Assuming I'm at line 10 and I want to do something like System.out.println("I am at line number " + ????);What method should I use to get "10"?
    Please advise.
    Thank you.

    If you run Java in Dos prompt, a new line of result is displayed at bottom and the screen scroll. There is no line number in that way. Other language like C have something like that.
    If you use Java Swing, you can display with x, y coordinate option but it is graphic mode.

  • How can I get Notification Number from Material Document?

    Can you please tell me that how can I get Notificatin Number(QMEL-QMNUM) from Material Document(MSEG-BELNR)?
    Regards,
    Subhasish

    This question is closed but unanswered.

  • Oracle EBS - Get Line number.

    Hi Friends,
    I got a tricky requirement.
    Get the line number which is in the Sales order form ie (1.1,2.1,3.1) , using the line_id.
    Is there any way to get the line numbers.
    Please help me.
    We can get the line_number using the query
    select line_number from oe_order_lines_all where header_id =12345
    but the requirement is get the line numbers which are displayed in Sales order form.
    it has some version numbers
    like
    1.1
    2.1
    1.1.1
    like this .. i need this line numbers.
    Any way to get this.
    Please help.

    Pl.try.
    select line_number, shipment_number, line_number||'.'||shipment_number from oe_order_lines_all where header_id = <i/p header_id>

  • Get SOAP Cannot Create XML Document reader error with Outlook integration?

    Hi,
    We installed Outlook Email Integration on a windows XP / Office 2007 machine and it installed OK. However when we click the "Add to CRM On Demand" button and try to login we get the following error message when we click the 'Sign In" button
    "SOAP: Cannot create XML document reader"
    Has anyone come across this? Are there any pre-requisites for using this add-in? e.g. Service Packs, .NET framework etc?
    Cheers

    It may not be the case...but pls. check if MS Word is defined as editing tool for email.. It should not be.
    ANotnio
    BExpert, Brazil

  • How to get Line number from a DOM Element

    Hi
    I am using dom xerces parser. Is there anyway to work out which line number a element will be when it is outputted into a file ??

    org.w3c.dom.DOMLocator method getLineNumber() returns the line number at which an error occurs.
    A corrresponding method for file output is not defined.

  • Remove first line in the XML Document

    Hi Friends,
    In my File to File scenario when ever new mesg is appending to file at receiver side,it should remove <?xml version="1.0" encoding="ISO-8859-1"?>  tag from the XML Document.This means <?xml version="1.0" encoding="ISO-8859-1"?> tag should appear once in a document.Plz suggest me to do this.
    Thanks
    pullarao.

    Hi there,
    you can either use XSLT (with output type="text") or Java, using the code:
    try {
      DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
      DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
      Document doc = docBuilder.parse(in);
      TransformerFactory tf = TransformerFactory.newInstance();
      Transformer trans = tf.newTransformer();
      trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
      DOMSource source = new DOMSource(doc);
      OutputStream out = new ByteArrayOutputStream();
      trans.transform(source, new StreamResult(out));
    } catch (...
    But as Bhavesh said, append mode is not recommended for XML files.
    Best approach is collect pattern on BPM.
    Regards,
    Henrique.

Maybe you are looking for

  • Safari redirecting to **** site

    This started happening December 2011. Whenever I click on a link in one of my e-mails and the link opens on Safari, the original page I intended to see will load and stay there for a while, and then Safari will automatically redirect to one of two si

  • Yoga 2 Pro with external Dell P2414H monitor - Win 8.1 issues

    I have a UK model Yoga 2 Pro (Core i7/256GB/8GB). Generally happy with it but I have one weird issue that is annoying me. The system is fully patched including all Windows updates and latest Lenovo BIOS and drivers. At work I have a Dell P2414H monit

  • Can I build a waveform reference

    I am using Labview 6 and would like to build a wave form reference property node. I want to do this so that I can use a for loop to create a series of waveform names and feed them to one property node , is this possible??

  • Very Slow Performance After Removing Windows Partition

    Hello, Recently I went through a failed attempt at installing Windows 7 onto my Macbook Pro using boot camp. After this failure I decided to try again another day and used the boot camp assistant to remove the Windows partition. Ever since doing this

  • Partial Page Rendering with HTMLDB2.0. How can I do it?

    Hi, somebody told me, that PPR is implemented in HTMLDB 2.0. So not the whole page will be rerendered after a submit but a single region. I know this very helpful feature from the ADF-Java Server Faces. How can I do it with HTMLDB 2.0? Bye, Rumburak