TransformerException, getting the source

Hi, I'm creating an XSLT editor, and using the javax.xml.transform library, I'm allowing the users to do the transformations in my program.
When the stylesheet is not valid, e.g. there is a missing tag, or an element missing a required attribute, an TransformerException is thrown. I would like to show them the source of the problem as the exception message doesn't always provide a line number.
I'm trying to use the source locator to provide better information, than that of:
file:///C:/Documents%20and%20Settings/y0210323/Desktop/classes/text.xsl: line 2: You cannot call an attribute ''
but unfortunately the source locator is always null, when I pull it from the exception.
public void alertError(TransformerException e){
     SourceLocator sl = e.getLocator();
     String line = "";
     if(sl != null){
          System.out.println("SL not null: "+ sl.getLineNumber());
     else{
          System.out.println("SL Null");
It always produces

I've sorted the problem out now.
The transformer exception sometimes wrapped the exception. I wrote a method to check if the sourcelocator was null for the given exception.
If it was null, it would recursively unwrap the exception to get the root. And depending on the class of the root it would get the line and column numbers. If the root was a TransformerException it would get the sourceLocator, but if it was a SAXParseException it would get the line and column numbers directly from the exception.

Similar Messages

  • How can i get the source code from java concurrent program in R12

    Hi 2 all,
    How can i get the source code from java concurrent program in R12? like , "AP Turnover Report" is java concurrent program, i need to get its source code to know its logic. how can i get its source code not the XML template?
    Regards,
    Zulqarnain

    user570667 wrote:
    Hi 2 all,
    How can i get the source code from java concurrent program in R12? like , "AP Turnover Report" is java concurrent program, i need to get its source code to know its logic. how can i get its source code not the XML template?
    Regards,
    ZulqarnainDid you see old threads for similar topic/discussion? -- https://forums.oracle.com/forums/search.jspa?threadID=&q=Java+AND+Concurrent+AND+Source+AND+Code&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

  • How to programmatically get the source for a class provided the class name?

    Hello,
    As a quick background, I am providing some tools to potential users of an in-house framework. One is the ability to generate quick prototypes from our existing demo applications. Assume a user downloads our jars and uses them in their project (we are using Eclipse, but that detail should not greatly affect my question). Included in the jars is a demos package that contains ready-to-run classes that serve to exhibit certain functionality. Since many users may just need quick extensions of these demos, I am trying to provide a way for them to be able to create a new project that starts with a copy of the demo class.
    So, the user is provided a list of the existing demos (each one uses a single class). When the user makes their selection, with the knowledge of our framework, I can translate that into what demo class they need (returned as a string of format package.subpack1.subpackn.DemoClassName). What I now want to do is to use that complete class name to get the source (look up the file) for the corresponding class, and copy it into to a new file in their project (the copying into the project can be done easily in Eclipse, so what I need help with is the bolded part). Is there a simple way to get the source given a class path for a class as described above? You may assume the source files are included in the jars for the framework.
    Thanks in advance.

    If there's a file named "package.subpack1.subpackn.DemoClassName.java" in a "demos" directory in the jar, then yes. You'd just use
    InputStream code = getResourceAsStream("/demos.package.subpack1.subpackn.DemoClassName.java");Or if those dots in the name actually separate directory names, i.e. you have a "package" directory under "demos" and a "subpack1" director under that and so on, then:
    InputStream code = getResourceAsStream("/demos/package/subpack1/subpackn/DemoClassName.java");

  • Getting the Source File name Info into Target Message

    Hi all,
    I want to get the Source file name Info into Target message of one of the fields.
    i followed Michal BLOG /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    Requirement :
    1) I am able to get the Target file name as same as the source file name when i check the ASMA in Sender & Receiver Adapter , with out any UDF...............this thing is OK
    2) I took One field extra in the target structure Like "FileName" & I mapped it Like
                              Constant(" " )--UDF-----FileName
    I Checked the Option ASMA in Both Sender & Receiver Adapters
    Here iam getting the Target File name as same as Source file name + Source File name Info in the Target Field " FileName".
    I Dont want to get the Target File name as same as Source file name. I want like Out.xml as Target file name.
    If i de-select the Option ASMA in Adapters means it is showing " null" value in the target field "FileName".
    Please Provide the Solution for this
    Regards
    Bopanna

    Hi All,
    Iam able to do this by checking the Option ASMA in only sender adapter itself
    Regards
    Bopanna

  • Where to get the source code of the owa_cookie.send procedure?

    I want to know where you get the source code of the owa_cookie.send procedure? I can only get the header of this package from ...\RDBMS\ADMIN\pubcook.sql. Could you paste the whole source code here and then I can modify it to set the 'httponly' attribute? I also have a problem that after changing the package, how to use the package I changed? Does it still a system package here? Or it has been changed to an user-defined package in database and I need to execute the package on the database for the web server?
    Thank you!

    Hi Arun,
    I am unable to see the pcui_gp components in the DTR ,I require this in order to get the source code of one of its component.
    Can you please tell me the step by step procedure getting those pcui_gp components from J2ee engine to the  dtr or  NWDI.
    If there are any documents on pcui_gp components exclusively please do forward to my mail id [email protected]
    Thansk and Regards,
    Anand.

  • How to get the source code of Java Concurrent Program?

    Hi,
    How to get the source code of Java Concurrent Program?
    Example
    Programe Name:Format Payment Instructions
    Executable:Format Payment Instructions
    Execution File Name:FDExtractAndFormatting
    Execution File Path:oracle.apps.iby.scheduler
    Thanks in advance,
    Senthil

    Go on Unix box at $JAVA_TOP/oracle/apps/iby/scheduler
    You will get class file FDExtractAndFormatting.
    Decompile it to get source code.
    Thanks, Avaneesh

  • How to get the source code of UI elements ?

    What is the way to get the source code of the elements used in qUnit Page for sap.m.List and all sap.m List Items ? I am looking to implement the same in my applications ?

    Hi Micheal,
    You can see the source code here for controls in sap.m.
    sap.m Explored
    Also for the link you provided, You can right click on the page and click on the View Page Source will show you the source code.
    Regards,
    KK

  • Is it possible to get the source code of sun package in JDK1.4?

    If i want to review the code of the HTTP protocol handler and some other things.
    how can i get the source. or is it possible?
    thank you.

    See this post if you can figure out something out of it ....
    http://forum.java.sun.com/thread.jsp?forum=31&thread=391451

  • How to get the source code of a PRT application in the portal

    Hi!
    Does anybody know how to get the source code of a PRT application in the portal?
    Thanks in advance,
    Celso

    Celso,
    If its Java-based code have a look at the properties of an iView that belongs to the application in question and copy the value of the Code Link parameter e.g. 'com.sap.pct.hcm.rc_vacancyrequestov.default'.
    Search the Portal installation directory under /j233/cluster/server/ for a .par.bak file of the same name, removing .default from the codelink parameter
    e.g. com.sap.pct.hcm.rc_vacancyrequestov.par.bak
    Copt this locally and import into Netweaver Developer Studio. You will have to decompilte the class files with a decompiler such as DJ Decompiler or Cavaj (search with Google).
    Cheers,
    Steve

  • How to get the source code of an HTML page in Text file Through J2EE

    How to get the source code of an HTML page in Text file Through J2EE?

    Huh? If you want something like your browser's "view source" command, simply use a URLConnection and read in the data from the URL in question. If the HTML page is instead locally on your machine, use a FileInputStream. There's no magic invovled either way.
    - Saish

  • How to get the source code of an HTML page in Text file Through java?

    How to get the source code of an HTML page in Text file Through java?
    I am coding an application.one module of that application is given below:
    The first part of the application is to connect our application to the existing HTML form.
    This module would make a connection with the HTML page. The HTML page contains the coding for the Form with various elements. The form may be a simple form with one or two fields or a complex one like the form for registering for a new Bank Account or new email account.
    The module will first connect through the HTML page and will fetch the HTML code into a Text File so that the code can be further processed.
    Could any body provide coding hint for that

    You're welcome. How about awarding them duke stars?
    edit: cheers!

  • Where to  find the pcui_gp  components ,How to get the source code of those

    Hi All,
    Can anybody tell the exact location wher the pcui_gp components will be stored if they are  not appearing.
    And another question is how to get the source code of the pcui_gp for customization.
    anybody working on these compoents please help me.
    answers will be rewarded.
    thanks and regards,
    anand

    Hi Arun,
    I am unable to see the pcui_gp components in the DTR ,I require this in order to get the source code of one of its component.
    Can you please tell me the step by step procedure getting those pcui_gp components from J2ee engine to the  dtr or  NWDI.
    If there are any documents on pcui_gp components exclusively please do forward to my mail id [email protected]
    Thansk and Regards,
    Anand.

  • How to get the source of a strange posted pic into my camera roll?

    I got a strange pic put into my camera roll, this pic is most likely put by an app which has an access to my photo gallery, all I want to know is how to get the source which put this image into my camera roll, I have a punch of apps that have a photo access grant and really don't know to disable all of these apps because of only one of them.
    p.s: the apps with photo access in my device (ProCam, CameraArtFXFree, Photo Editior-, Instagram, Poster++, Photo Vault, Facebook, Tango, Viber, Y! Messenger, Ipadio, Line, WhatsApp) And the only opened apps when this photo pushed to my Camera Roll were (Viber, Tango, Line, Whatsapp).
    Thanks in advance.

    >
    Nitesh Kumar wrote:
    > Hi,
    >
    > FM to get the program source code: RPY_PROGRAM_READ
    >
    > By using this FM you can get the program name(say report_name) and then you can use
    >
    > READ REPORT report_name INTO itab
    >
    > Thanks
    > Nitesh
    u dont need the last statement the FM itself returns an itab with code in it.

  • How will get the source code of all the tables in a given schema using SQL?

    Hi All,
    How can we get the source code of all the tables in a given schema using SQL?
    Thanks in Adv.
    Junu

    Try something like...
    set heading off
    set pagesize 0
    col meta_data for a96 word_wrapped
    set long 100000
    SELECT DBMS_METADATA.GET_DDL(object_type, object_name, owner) ||';' AS meta_data
    FROM dba_objects
    WHERE owner = '<SCHEMA NAME>'
      AND object_type not in (<list of stuff you do not want>);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to get the source og region code in the url

    Here is an workflow function which is defined as follows
    Item Type :HR
    Internal Name: HR_MAINTAIN_MAIN_ADDR_JSP_FCT
    Function Name: HR_WORKFLOW_SERVICE.BLOCK
    Node Attributes :
    Name: HrActivity Type: value: JSP
    Name: HrActivityTypeVAlue Value:HR_MAIN_ADDR_TOP_SS
    I do not find that HR_MAIN_ADDR_TOP_SS is mapped to any OAF page
    What is HR_MAIN_ADDR_TOP_SS?
    How to see the source code of HR_MAIN_ADDR_TOP_SS. Is there any SQL query to get the source of this.
    http://hostname:8027/OA_HTML/OA.jsp?_rc=HR_MAIN_ADDR_ACT_TYPE_TOP_SS&_ri=800&OAFunc=XXCHR_ESS_PER_INFO&_ti=1902574799&retainAM=Y&addBreadCrumb=N&oapc=11&oas=zgiSEq6kVqEuZNnwZ5lP5g..
    what is HR_MAIN_ADDR_ACT_TYPE_TOP_SS in the above URL

    Hi,
    I am wants to know about the Hr Activity Type Value in workflow activity HR_WORKFLOW_SERVICE.BLOCK. Is it a region? Pla advise..
    Thanks & Regards
    Radhakrishnan

Maybe you are looking for

  • Unable to perform database compare

    Recently, not since three or four days, we have been facing an issue when trying to compare within visual studio 2013 on a database project. The compare screen loads up but I'm not able to select source or target. Nothing happens if I click the targe

  • .xls and .xlsx file upload in webdynpro

    Hi All, Its very urgent.Tried for many options, Searched the scn. But no result. None of them are consistent while uploading xls and xlsx file. Sometimes the same file is working garbage value and sometime is working fine. Even I tried using CL_FDT_X

  • When I go to the apple store to exchange it, what do I say and do? Does my iPod touch gen5 need to be in the casing and all that when I give it?

    Yeah reply a.s.a.p All I have is the original packaging the iPod came with. Do I bring that or do I just bring the broken iPod touch gen5 But what do I say?

  • Safe mode: visual indicator?

    hi: i had to use safe mode extensively to get myself out a major pickle. i am back up running again, nearly a day later. but now, i wonder, how do i know for sure, there is no parts of "safe mode" still ON. is there a visual indicator? I have my book

  • Workflow : Travel request attachment

    HI, I have a question regarding workflow. When a traveler fills a travel request using TRIP and saves it, workflow starts. The request goes to manager for approval. The problem is that when the manager clicks the attachment, it opens with PR05 not wi