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

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

      The is my database version:
      Oracle Database 11g Enterprise Edition Release - 64bit Production
      PL/SQL Release - Production
      CORE      Production
      TNS for Solaris: Version - Production
      NLSRTL Version - 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.
          I'm not sure I follow fully. I don't have to test against, but I do not encounter any issue with this simple example
          Connected to Oracle Database 11g Enterprise Edition Release 
          SQL> set serveroutput on;
          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 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.
            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.