2 Replies Latest reply: May 6, 2013 6:59 PM by CRoberts RSS

    Start/End Tags are not being accepted by parse if null.

    CRoberts
      The is my database version:
      BANNER
      --------------------------------------------------------------------------------
      Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
      PL/SQL Release 11.2.0.2.0 - Production
      CORE    11.2.0.2.0      Production
      TNS for Solaris: Version 11.2.0.2.0 - Production
      NLSRTL Version 11.2.0.2.0 - Production
      We have a new application that pretty much generates the xml tags. The sending system uses two tags even when a NULL value is being sent. However the Oracle parser does not like it. We get this error:
      ORA-31011: XML parsing failed
      ORA-19202: Error occurred in XML processing
      LPX-00231: invalid character 47 ('/') found in a Name or Nmtoken
      Error at line 1
      When I receive a list of parameters as a clob, I then cast it as xml for processing. When I use a tag like <phase/>, the xml parser accepts it. However, when I put into the format being sent <phase></phase> to signify a NULL value. The following is the code snippet that generates the error.
      vXmlDoc := XMLTYPE(pSearchParams_Tx);
      My question is there any way to allow the xml parser to accept the default format that is being sent in? Perhaps is the some sort of pre-processing that would allow the sent in format to be used? Thank you.
        • 1. Re: Start/End Tags are not being accepted by parse if null.
          Jason_(A_Non)
          I'm not sure I follow fully. I don't have 11.2.0.2 to test against, but I do not encounter any issue with this simple example
          Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 
           
          SQL> set serveroutput on;
          SQL> 
          SQL> declare
            2    pSearchParams_Tx   CLOB;
            3    vXmlDoc            XMLTYPE;
            4  begin
            5    pSearchParams_Tx := '<phase/>';
            6    vXmlDoc := XMLTYPE(pSearchParams_Tx);
            7    dbms_output.put_line('Done 1');
            8    pSearchParams_Tx := '<phase></phase>';
            9    vXmlDoc := XMLTYPE(pSearchParams_Tx);
           10    dbms_output.put_line('Done 2');
           11  end;
           12  /
           
          Done 1
          Done 2
           
          PL/SQL procedure successfully completed
          I get the same thing on 11.1.0.6 as well.

          Do you have a code example that demonstrates the error?
          • 2. Re: Start/End Tags are not being accepted by parse if null.
            CRoberts
            Thank you for your input. My test case was apparently too involved. The tag had an extra slash. The xml parser works with one or two tags when a null is present. Thank you, your test case was good.