10 Replies Latest reply: Feb 22, 2012 7:22 AM by AlexAnd RSS

    how to register the .DTD file in Oracle Apps

    918769
      Hi,

      I am getting below error while generating XML file by concurrent program:
      Attaching XML file and .DTD file.
      Do I need to register this .DTD file somewhere?

      The XML page cannot be displayed

      Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.





      --------------------------------------------------------------------------------

      System error: -2146697210. Error processing resource 'http://mbci-ebsdev.itciss.com/OA_CGI/label.dtd'.

      Below is the stored procedure I created to generate the XML file

      create or replace
      PROCEDURE Demo_XML_Publisher (errbuf VARCHAR2,retcode NUMBER,v_customer_id VARCHAR2)

      AS
      /*Cursor to fetch Customer Records*/
      CURSOR xml_parent
      is
      SELECT header_id,ordered_item
      FROM oe_order_lines_all
      WHERE header_id = v_customer_id;
      /*Cursor to fetch customer invoice records*/
      CURSOR xml_detail(p_customer_id NUMBER)
      is
      select a.order_number,a.header_id,a.order_type_id
      from oe_order_headers_all a,oe_order_lines_all b
      where a.HEADER_ID = B.HEADER_ID
      and a.header_id = p_customer_id
      AND ROWNUM<4;

      BEGIN
      /*First line of XML data should be <?xml version=”1.0??>*/
      FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<?xml version="1.0" encoding="UTF-8"?>');
      FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<!DOCTYPE labels SYSTEM "label.dtd">');
      FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<labels FORMAT="order.btw" PRINTERNAME="KIMBALL1872A" _QUANTITY="1">' );
      FOR v_customer IN xml_parent
      LOOP
      /*For each record create a group tag <P_CUSTOMER> at the start*/
      FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<label>');
      /*Embed data between XML tags for ex:- <CUSTOMER_NAME>ABCD</CUSTOMER_NAME>*/
      FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<HEADER_ID>' || V_CUSTOMER.header_id
      || '</HEADER_ID>');
      FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<ORDERED_ITEM>' || v_customer.ordered_item ||
      '</ORDERED_ITEM>');
      FOR v_details IN xml_detail(v_customer.header_id)
      LOOP
      /*For customer invoices create a group tag <P_INVOICES> at the
      start*/
      FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<P_INVOICES>');
      FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<variable name= "Order_no">' ||
      V_DETAILS.ORDER_NUMBER || '</variable>');
      FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<variable name= "Headr_Id">' ||
      V_DETAILS.HEADER_ID || '</variable>');
      FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<variable name= "Order_Type_Id">'||
      v_details.order_type_id||'</variable>');
      /*Close the group tag </P_INVOICES> at the end of customer invoices*/
      FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'</P_INVOICES>');
      END LOOP;
      /*Close the group tag </P_CUSTOMER> at the end of customer record*/
      FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'</label>');
      END LOOP;
      /*Finally Close the starting Report tag*/
      FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'</labels>');
      exception when others then
      FND_FILE.PUT_LINE(FND_FILE.log,'Entered into exception');
      END Demo_XML_Publisher;


      Below is the Label.dtd file structure m using:

      <!ELEMENT labels (label)*>
      <!ATTLIST labels _FORMAT CDATA #IMPLIED>
      <!ATTLIST labels _JOBNAME CDATA #IMPLIED>
      <!ATTLIST labels _QUANTITY CDATA #IMPLIED>
      <!ATTLIST labels _PRINTERNAME CDATA #IMPLIED>
      <!ELEMENT label (variable)*>
      <!ATTLIST label _FORMAT CDATA #IMPLIED>
      <!ATTLIST label _JOBNAME CDATA #IMPLIED>
      <!ATTLIST label _QUANTITY CDATA #IMPLIED>
      <!ATTLIST label _PRINTERNAME CDATA #IMPLIED>
      <!ELEMENT variable (#PCDATA)>
      <!ATTLIST variable name CDATA #IMPLIED>


      Thanks in Advance
        • 1. Re: how to register the .DTD file in Oracle Apps
          AlexAnd
          why do you want use .dtd for creating xml publisher report?

          you create xml output by procedure Demo_XML_Publisher and this result you want to paint on something template
          so
          i think what you don't needed in .dtd
          • 2. Re: how to register the .DTD file in Oracle Apps
            tsuji
            In any case, the dtd is incorrect and that may be why. The element structure is at least look like this.
            <!ELEMENT labels (label*)>
            <!ELEMENT label (CUSTOMER_NAME?, HEADER_ID, ORDERED_ITEM, P_INVOICES*)>
            <!ELEMENT P_INVOICES (variable, variable, variable)>
            If you want to keep some flexibility on variable's cardinality, you can simply it like this.
            <!ELEMENT labels (label*)>
            <!ELEMENT label (CUSTOMER_NAME?, HEADER_ID, ORDERED_ITEM, P_INVOICES*)>
            <!ELEMENT P_INVOICES (variable+)>
            Then you add the appropriate ATTLIST for the elements.
            • 3. Re: how to register the .DTD file in Oracle Apps
              918769
              Hi,

              Thanks for responding, One more question where do we have to keep this Label.DTD on server?
              • 4. Re: how to register the .DTD file in Oracle Apps
                tsuji
                where do we have to keep this Label.DTD on server?
                The answer is from your own line:
                FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<!DOCTYPE labels SYSTEM "label.dtd">');
                It should, a priori, be put in the same directory of the xml document. But, in general, in your java code or some other coding language of full capability of implementing an Entity Resolver, you can re-direct to some place to your liking if the label.dtd is not found.
                • 5. Re: how to register the .DTD file in Oracle Apps
                  AlexAnd
                  see last reply in thread Re: How do I use DTD's will XML DB ?


                  2 tsuji
                  user create report by xml publisher
                  data for report are generated by FND_FILE.PUT_LINE(FND_FILE.OUTPUT... - this generate data for report in one file in temporary directory. you can't generate several files, only one temporary file for report purpose
                  • 6. Re: how to register the .DTD file in Oracle Apps
                    tsuji
                    Hi, you are most probably right, Alex. I can't even say right or wrong, helas. But I don't think the issue is to create multiple file. I would see the matter like this: that the label.dtd or whatever be a static file for validation purpose of the generated specific report(s) (which seems to be an xml...). In any care, I'll take your words for granted. Thank you!
                    • 7. Re: how to register the .DTD file in Oracle Apps
                      odie_63
                      Alex,

                      I think the question is how does the DTD url is resolved in the process?
                      If the XML file is parsed in the database, we know that the DTD must reside in the XML DB repository, but I don't think that's the case here with XML Publisher.

                      From OP's first post, the DTD is expected at "http://mbci-ebsdev.itciss.com/OA_CGI/label.dtd".
                      So I guess (s?)he just has to determine what's the corresponding physical location.

                      But as you said earlier, using a DTD may not be needed at all.
                      • 8. Re: how to register the .DTD file in Oracle Apps
                        918769
                        Hi Alex,

                        My req is to send the XML data to the third party tool (which takes a specified format of XML)to print the labels. .DTD file is available in that server and I have to use it.
                        I am generating the XML data by a concurrent program, but when I am trying to open that output from front end, thats giving me the above mentioned error.
                        I am not able to open the output file.
                        Please suggest.

                        Reards,
                        Meetu
                        • 9. Re: how to register the .DTD file in Oracle Apps
                          AlexAnd
                          if you want generate xml with dtd by concurrent program then may be this way...

                          when you "view output" then xml can't show correctly but concurren programm completed with success

                          but xml is valid and with dtd
                          in browser -> show html code -> copy&past in file.xml -> sent to


                          may be exist another way
                          General EBS Discussion
                          • 10. Re: how to register the .DTD file in Oracle Apps
                            AlexAnd
                            i find another way

                            in apps exist directory with path $OA_MEDIA

                            i copied Label.dtd to $OA_MEDIA

                            and in package use
                              fnd_file.put_line(fnd_file.output, '<?xml version="1.0" encoding="UTF-8"?>');
                              fnd_file.put_line(fnd_file.output, '<!DOCTYPE labels SYSTEM "http://url_oebs:port_oebs/OA_MEDIA/Label.dtd">');
                            for example
                              fnd_file.put_line(fnd_file.output, '<!DOCTYPE labels SYSTEM "http://oebs:8000/OA_MEDIA/Label.dtd">');
                            ran concurrent program and OK

                            try please my steps