Error when generating XML

Hi, I am trying to generate an XML file using the code below and receive the following error;
failed ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00231: invalid character 60 ('<') found in a Name or Nmtoken
Error at line 47102066
The code inside the procedure is:
xml_result xmltype;
doc        dbms_xmldom.DOMDocument;
ctx DBMS_XMLGEN.ctxHandle;
vv_exit_code varchar2(5);
vv_ctx_open varchar2(1) := 'N';
  BEGIN
vv_exit_code := 'XML1';
  ctx := dbms_xmlgen.newcontext(p_sql);
  vv_ctx_open := 'Y';
DBMS_OUTPUT.put_line(vv_exit_code);
vv_exit_code := 'XML2';
  DBMS_XMLGEN.SETCONVERTSPECIALCHARS (ctx,TRUE);
DBMS_OUTPUT.put_line(vv_exit_code);
  vv_exit_code := 'XML3';
xml_result := dbms_xmlgen.getXMLType(ctx);
DBMS_OUTPUT.put_line(vv_exit_code);
IF xml_result is not null THEN
     vv_exit_code := 'XML4';
     doc := dbms_xmldom.newDOMDocument(xml_result);
DBMS_OUTPUT.put_line(vv_exit_code);
     vv_exit_code := 'XML5';
     dbms_xmldom.writeToFile(doc,p_dir||'/'||p_fileName, 'ISO-8859-1');
DBMS_OUTPUT.put_line(vv_exit_code);
     vv_exit_code := 'XML6';
     dbms_xmldom.freeDocument(doc);
     p_xml_created := 'TRUE';
DBMS_OUTPUT.put_line(vv_exit_code);
ELSE
    p_xml_created := 'FALSE';
END IF;
DBMS_XMLGEN.CLOSECONTEXT (ctx);
vv_ctx_open := 'N';
EXCEPTION
     WHEN out_of_process_memory THEN
    IF vv_ctx_open = 'Y' THEN
        DBMS_XMLGEN.CLOSECONTEXT (ctx);
    END IF;
    gv_err_msg := substr(sqlerrm,1,2000);
    DBMS_OUTPUT.put_line(gv_process_name||' failed '||gv_err_msg);
    RAISE_APPLICATION_ERROR(-20906,gv_process_name||' failed'||gv_err_msg);
      dbms_output.put_line('XML_EXPORT failed (out_of_process_memory exception) executing '||p_sql);
      raise_application_error(-20906,'XML_EXPORT (out_of_process_memory exception) failed executing '||p_sql);
    WHEN OTHERS THEN
    IF vv_ctx_open = 'Y' THEN
        DBMS_XMLGEN.CLOSECONTEXT (ctx);
    END IF;
    if xml_result is NULL then
          gv_err_msg := substr(sqlerrm,1,2000);
    DBMS_OUTPUT.put_line(gv_process_name||' failed '||gv_err_msg);
    RAISE_APPLICATION_ERROR(-20906,gv_process_name||' failed'||gv_err_msg);
          dbms_output.put_line('XML_EXPORT failed (xml results are NULL) executing '||p_sql);
          raise_application_error(-20906,'XML_EXPORT (xml results are NULL) failed executing '||p_sql);
    else
    gv_err_msg := substr(sqlerrm,1,2000);
    DBMS_OUTPUT.put_line(gv_process_name||' failed '||gv_err_msg);
      dbms_output.put_line('XML_EXPORT failed (others exception) executing '||p_sql);
      DBMS_OUTPUT.put_line('Export Directory is: '||p_dir||'/'||p_fileName);
      raise_application_error(-20906,'XML_EXPORT (others exception) failed executing '||p_sql);
end if;
I have run the p_sql separately and have no issue. The p_sql is select * from <viewname> where date_id > '20100901' and date_id < '20100930'; (For security reasons I am choosing to leave off specific table/view/column names). I have run this procedure with other date ranges and it works for all the views we are using. I have examined all freeform data (data entered by the user without restriction) and none has a '>' in it during this time period.

All the column names are valid XML names as this returned for other date ranges (as stated). The oracle version is 11G. This code is encapsulated in a function with the following signature:
PROCEDURE sql_to_xml(p_sql IN VARCHAR2, p_fileName IN VARCHAR2, p_dir IN VARCHAR2, p_xml_created OUT VARCHAR2)
To test, I have been calling the package with the sql as I indicated originally, a filename, the unix directory to write to, and a global out variable. Again, as I originally stated, this has been run successfully for other date ranges for the same table, but only fails in a specific range.
As for the issue with the line number it isn't a copy paste error at all. My total code for this package has 84 lines (including comments etc) (i removed function signature when quoting the code above). The line error message confused me as well, which was part of what I hoped someone else who had done XML exporting would know of. My assumption was that the line number was the line of the XML file, not the code. However because it fails it won't create the XML server onto the directory so I cannot view it and see easily where it breaks.
You are correct that line 52 makes 54 and 55 useless. I think that was a relic of a previous version and I forgot to remove 52. I did so and will see if the below error is raised.
I forgot to state that the DBMS_OUTPUT does show XML3 indicating that either XML_RESULT is null or that it breaks at line 19 (because DBMS_OUTPUT never prints XML4). Because you caught the issue with line 52-55, that may be why the null error never was being raised. I am rerunning to verify that xml_result is not null (ie: the null exception raised from the if on line 49 does not trigger).

Similar Messages

  • Error when generating the report in Production Server

    Hi,
    I have created one infoset query in Development server of my client. It is working fine there. I had transported the request containg this query to Production server. But whenever I am trying to generate report using this query in Production server it is giving an error message
    "Error when generating the report".
    I am not getting what 's problem.
    Samriddhi

    Samriddhi,
    Genarally its not suggested to transport Queries. Should be able to create Queries directly Production. There might be diferences between your Development and Production versions.
    Thanks.

  • Error When generating  dataprovider

    HI ,
    i get an error message while executing a query in rsrt.
    "Error When generating  dataprovider
    Notification Number BRAIN 282 "
    require help in this regard,
    Rakesh.

    By best approach in that case is trial and error.
    Copy that query to a new one and change it step by step (creating it simpler, by removing key figures and characteristics) executing it in each step until you don't find the error. There you can see what is causing that error.
    Diogo.

  • Error when generating the report (see long text), Message no. AQ_AD_HOC221

    Hi All,
    I am facing a peculiar problem while executing an infoset query.I have created 2 customized fields Compa-ratio and PIR in infotype 0008 in an infoset.I have coded in these additional fields.
    When I execute a query using 1 of these customized fields the report is generated correctly.But when I put both the fields in the output the report shows an error "Error when generating the report (see long text)". The message# associated with this errAQ_AD_HOC221.
    I have also checked the data types and the references. Nothing seems to be wrong here.
    Does anybody has any clue about this ?
    Kajal

    Hi Bernd,
    I had a look at those notes. But the information provided did'nt prove to be helpful. I found out the problem. I was using the same local variable for both the fields in their code. This generated the error. This error is a very generic one and does'nt help in finding out what exactly is the problem.
    I changed the other local variable and it started working. When I was using the same variable that time I did'nt forget to clear the values but the query still generated the error.
    Anyways thanks a lot for the reply.
    Kajal

  • Soap response Error when processing XML CF.

    Hello,
    I have problems with soap response and wondered if you could give some advice.
    Every time I send my message via soap I get the following error:
    com.sap.aii.af.ra.ms.api.RecoverableException: SOAP: response message contains an error XIAdapter/HTTP/ADAPTER.HTTP_EXCEPTION - HTTP 500 Error when processing XML CF.
    Is it possible that the communication is aborted and  my response message mapping is never started?
    (Additional info: I tried to create an integration process and am not able to evaluate the response.)
    Thanks a lot for your help.
    Regards,
    Julia

    hi,
    do you see any more error details in :
    http://xiserver:port/MessagingSystem/monitor
    did you check logs in visual admin ?
    >>>>Is it possible that the communication is aborted and my response message mapping is never started?
    yes - if the response is not ok the mapping may not be started
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • Error 500 Internal Server Error" When Generating Hyperion Financial Reports in PDF Format

    We are unable to open pdf reports in Workspace with the following error. It was all working fine and doesn't work now for unknown reasons.
    Error 500 Internal Server Error" When Generating Hyperion Financial Reports in PDF Format
    We are on 11.1.2.1 environment. Ghost Script 8.54 and Java heap settings xms256m and xmx512m.
    Please advice.

    hello,
    just to clarify
    a) the parameter is named DESFORMAT not :DESFORMAT, there is
    no : in front of the name, if you submit it via URL !
    b) there are some issues with acrobat5 and IE but those are not
    only caused by PDFs generated with oracle reports.
    regards,
    the oracle reports team --pw                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Error when generating catalog SRM_EXTRACTED_CTLG

    Dear All,
    We are trying to transfer product and contract catalogs from SRM server to Catalog authoring tool. The RFC connections were created and scenarios in XI have been imported as per the cookbook. The XI part seems to be working fine and a correct response was received by XI (as per SXMB_MONI), but we find the following error in the SRM application log (tcode: SLG1)
    The following exception was raised:
    /CCM/CX_OBJECT_CREATION_FAILED
    Error when generating catalog SRM_EXTRACTED_CTLG
    The exception occurred at the following point: 
    Program  /CCM/CL_CATALOG_MANAGER=======CP 
    $EXC_CLASS    /CCM/CX_OBJECT_NOT_FOUND
    The earlier threads seemed to mention applying service packs so we did a check and found everything fairly up to date, as follows:
    SRM Server 5.5 (Service Pack 4)
    ABAP Rel 7 (Service Pack 7)
    CCM Server 2 (Service Pack 4)
    As I'm basically an XI person, I'm not sure how to debug this error. Can anyone please help me out on his?
    Thanks and Regards
    Arun

    Hi All,
    Just bumping up my question again. Any pointer on this... please?
    Best regards,
    Arun

  • Error when Generating the Program

    Recently there was an SP upgrade and my Planning Book started giving me this error message (SCM version =5.0 and SP = 7)
    "Error when generating the program" Message no. /SAPAPO/TSM141
    Diagnosis: Generated programs are programs that are generated based on individual data objects, such as planning object structure, planning areas and Infocubes. These programs are then executed in the transaction. An error occured during the generation of such a program
    Possible causes:
    1. The template has been corrupted
    2. The object that the template uses to generate the program contains inconsistencies; for instance an Infocube has not been activated
    This error occurs when I try to open the my planning book/creating the selection profile. I've re-activated the Infocube and later deactivate and active my POS and tried to do the same for the Planning Area....but the error still persists. I tried to create a new planning area and tried it again but the error still persists. I've tried to fix any inconsistencies in the planning area time series objects by running the consistency check....however the same error pops up during the consistency check....
    Anyone encountered this error message and any possible solutions to this issue.
    Thanks
    Surender

    I did find an ABAP Dump when looking at ST22.  The short message is as follows:
    Runtime Errors         GEN_BRANCHOFFSET_LIMIT_REACHED
    Date and Time          05/14/2007 19:33:54
    Short text
         Jump distance is too large and cannot be generated.
    What happened?
         A jump distance is too large and cannot be generated.
         A control structure or a routine with "CHECK" or "EXIT" contains
         too many ABAP statements.
         Error in the ABAP Application Program
         The current ABAP program "GP_MET_PSTRU_BASIC_FORMS" had to be terminate
          because it has
         come across a statement that unfortunately cannot be executed.
    What can you do?
         Note down which actions and inputs caused the error.
         To process the problem further, contact you SAP system
         administrator.
         Using Transaction ST22 for ABAP Dump Analysis, you can look
         at and manage termination messages, and you can also
         keep them for a long time.
    Error analysis
         During the generation of program "GP_MET_PSTRU_BASIC_FORMS", the system
          determined that
         within an ABAP event a control structure (for example, IF..ENDIF
         or LOOP..ENDLOOP) or a routine (for example, FORM routine) has
         become too large. The resulting jump distance is too large so that
        it could no longer be generated.
        With the internal load format, the jump distance must not be
        greater than 32768 (this is the size of approximately 10.000
        ABAP statements).
        The jump distance that is to be generated, however, is 50885.
    How to correct the error
       The ABAP application program must be changed.

  • Error when  importing xml data

    I am getting the following error when loading xml datafile to my Oracle XE database table. This data I exported from htmldb.oracle.com.
    ORA-31011: XML parsing failed ORA-19202: Error occurred in XML processing LPX-00222: error received from SAX callback function
    please help
    George

    George,
    I expect that this is simply an incompatibility with the date format that was used for XML Import/Export as part of XE Beta. This is a bug that has been fixed for XE production and you will be able to freely export from HTML DB 2.0 and import into XE and vice versa.
    Your NLS settings do not control this. The date format used for XML Export is fixed - a canonical date format is always used.
    If you want to be able to import into XE Beta, your date fields probably look like:
    <HIREDATE>2005-12-03T00:00:00.000</HIREDATE>Just remove the trailing .000 from your date entries.
    <HIREDATE>2005-12-03T00:00:00</HIREDATE>
    Note: This will only be necessary for XE Beta. You should not have to do this for XE Production.
    Joel

  • Error when generating the update program RSAU484

    Hi,
    I am getting the following error while loading data into customer master  from CRM system
    Error when generating the update program
    Message no. RSAU484
    Diagnosis
    An error occurred during program generation for InfoSource MR_CDB_CUST_HFR and InfoProvider 0BPARTNER$T. This may be extrapolated to incorrect update rules.
    Procedure
    Check and correct your update rules and then generate the update program again. You can find help on the error in the error log.

    Yes,there is just a single line of code in the start routine
    DELETE DATA_PACKAGE WHERE CUSTOMER is initial.
    and update rules  for Business partner and customer market which are object mapped 1:1. No routines or formulaes.
    Could this be a technical issue on the flexible update or a data quality ?

  • 'Error when generating the selection screen "0500"

    Dear all,
    I have copied a function group QEES to ZQEES through SE80. In that I have copied all screens, includes, function modules etc..
    Now when I activate the ZQEES, I get an error 'Error when generating the selection screen "0500" of report "SAPLZQEES'.
    There is no problem with screen 0500, I have activated it.
    But when I activate ZQQES, I get the error.
    Please let me know the reason for this.
    It will be highly appr
    Thanks in advance,
    Sachin

    Hi Sachin,
    there could be a problem while copying in renaming, delete the Function group ZQEES  and recopy the  Standrad function group and only rename  the  the FM QEES_SHOW_SELECTION_SCREEN to ZQEES_SHOW_SELECTION_SCREEN and copy and activate it will work.
    regards,
    Srini

  • Error when generating the update program

    Hi BW Experts,
    I am facing issue while loading data to cubes:
    0TCT_C01 & 0TCT_C02
    In load monitor (RSMO) -> details> some data pakages are going thru successfully while some are failing with error:
    Error when generating the update program
    Thanks

    Hello,
    Try activating both the cubes using RSDG_CUBE_ACTIVATE. Activate them even thou they seem active.
    Also you can refer to OSS Notes:
    Note 1146851 - BI 7.0 (SP 18): Error RSAU 484 when generating update
    Note 1152453 - Termination generating InfoCube write program
    Regards,
    Shashank

  • Error when generating master data routines

    Hello all,
    I´m trying to activate 0BPARTNER but an error appears: Error when generating master data routines, and no more information is provided.
    I´m working with BW 7.0.
    Has anybody had this problem?
    How could I solve it?
    Thanks in advance.
    Carmen

    Hi Carmen,
    I'm working with SAP BW 700 and I had also this error during a characteristic activation in my QA system. This happened when I tried to transport the activated characteristic from my DEV system.
    I found  also message TK425 when I was trying activation through RSDG_IOBJ_ACTIVATE program.
    I solved this error message with OSS note 01458319 700SP24: "Transport fails during the impact analysis of DTP".-
    I hope this helps.
    Best Regards.
    AW

  • Error when generating transport dataset (transfering queries with RSAQR3TR)

    Hi!
    I try to transfer queries from one system to other.
    Systems are not connected with each other, so no transports are available.
    I am doing like this:
    - running program RSAQR3TR in "old" system
    - downloading a query as TXT file into my PC
    - running program RSAQR3TR in "new" system
    - uploading TXT file into "new" system and get a message - "Error when generating transport dataset"
    I have only query and user group in "old" system. Is this information enough to transfer them to "new" system?
    <b><REMOVED BY MODERATOR></b>
    Mindaugas
    Message was edited by:
            Alvaro Tejada Galindo

    Hi,
    Step 1. Run RSAQR3TR in 'old' system. Select EXPORT and specify the objects to be transported. 
    (System includes these in an automatically created transport request) 
    Step 2. Release this transport and request it be transported to 'new' system. 
    (This results in the entries being populated in transport table AQTDB in 'new' system). 
    Step 3. Run RSAQR3TR in 'new' system. Select IMPORT and tick the Overwrite checkbox. Specify the transport number in the field labelled 'dataset with imports'. 
    (RSAQR3TR gives the message that stuff has been imported OK). 
    Step 4. if you still couldn't find the queries, so ran RSAQR3TR one more time, this time specifying 'Copy Standard Area -> Global Area'
    Regards
    Sudheer

  • Error when generating program /SAPAPO/TSM141

    Hello APO Experts!!
    I have one infocube for sales history, which has one key figure that contains the sales history values.
    First, I was using this key figure in one planning area. This Key Figure Semantics for Read and Write Operations was 002 = Semantics for InfoCube key figures.
    Now, I had to include the same key figure in another planning area and with the same configuration Semantics = 002.
    The problem is, in my DEV system, the modification was perfect. Then when I did in the QA system, I´ve got the error  "Error when generating program /SAPAPO/TSM141" when trying to access the data in the planning books that are created in the first planning area.
    For the second planning area, nothing happens, everything is working correctly.
    Do you have any idea of what this could be?
    Regards
    Anglea

    Hi
    Sounds like a Planning Area extraction problem. First of all check that all your required BW InfoObjects are created for the Planning Areas, then check that the Semantics you mentioned are the same for all Aggregates in the Planning Area.
    Also try running program /SAPAPO/TS_PSTRU_GEN to regenerate the planning area extractor.
    Delete and recreate the data source.
    Hope that helps
    Regards
    Ian

Maybe you are looking for

  • Producer Consumer Parallelism Failing!

    I'm controlling multiple automation stations with a single cRIO 9074 -- the multiple stations are all following the same logic but should be independently controlled. I'd like to accept all digital inputs (from all stations) in a producer loop, queue

  • Idvd says disk not recordable

    Need help with burning a disk from iDVD- always worked without issue, but now it rejects my DVD disks saying it is not recordable

  • How to display X value against a particular Y value in XY graph

    Hi labview gurus, I've a  XY graph, time is plotted in X axis and amplitude is plaotted in Y axis, I want to display the value of X at a particular value of Y. Please let me know how to do this programatically. VI Attached. Attachments: testplotv8.5.

  • What is my DNS for my new website setup?

    What is my DNS for my new website setup? I am registering my new Domain name with an outside website service (not iWeb). Namecheap.com What Mac OS X 10.8.2 DNS do I use for my server setup with thru their business? They have asked me this question. O

  • Wierd issue with Sample Editor...

    Hi again! More questions to use this program efficiently without pulling all my hair out... When I'm using the "time and pitch machine" under Factory in Sample Editor, I've run across an issue. I got a sample to loop accordingly Trimming off the rest