XML escape sequences for brackets and xmltype.extract

G'day gang, I'm hoping somebody would be kind enough to help me with the following query please.
I have a web service that is returning the following XML stream into an XMLType in the database:
<OutOfStockAdviceResponse xmlns="http://abc.org/abcWebServices">
  <OutOfStockAdviceResult>
  & lt;Response& lt;ResponseCode& gt;0& lt;/ResponseCode& gt;
  & lt;ResponseMessage& gt;Successful& lt;/ResponseMessage& gt;
  & lt;/Response& gt;
  </OutOfStockAdviceResult>
</OutOfStockAdviceeResponse>You'll note the & lt; and & gt; characters (note to display these strings in OTN I've had to add a space between the & and the lt; or gt;. The spaces don't actually occur in the real XML data coming back).
What's odd about this XML stream coming back is it is mixing the use of the XML angle brackets with the escape character equivalents (eg. & lt; and & gt;) half way through the XML stream. Is this valid for an XML stream to do this? Any idea what would cause this? Is it possible the source is creating 2 separate XML streams using different character sets and then concatenating them to get this result?
The reason I'm asking is I'm attempting via PL/SQL to extract the ResponseCode and ResponseMessage tags with the following code:
  v_response_code := XMLType.extract(v_response,
      '/OutOfStockAdviceResponse/OutOfStockAdviceResult/Response/ResponseCode/text()',
      'xmlns="http://abc.org/abcWebServices"').getnumberval;
  v_response_msg  := XMLType.extract(v_response,
      '/OutOfStockAdviceResponse/OutOfStockAdviceResult/Response/ResponseMessage/text()',
      'xmlns="http://abc.org/abcWebServices"').getstringval;Both calls are failing with:
ORA-30625: method dispatch on NULL SELF argument is disallowedCan anybody point me in the right direction for solving this issue? Is there a way to get the xmltype.extract function to recognize the different character encoding schemes (if they do indeed actually exist)?
Any help appreciated.
CM.
PS. Apologize for the weak subject line.

Chris
Since that Serviceis actually returning the escaped representation of '<' and '>' inside OutOfStocAdviceResult, the XML Parser considers that whole block of text to be simply a text node child the parent element, not valid XML. Hence the result of your XPath expressions is null and you get the ORA-30625 when you try to invoke the getNumberVal() and getStringVal() methods, which is the PL/SQL equivilant of a Java Null Pointer Exception.
You can solve it as follows...
set define off
set serveroutput on
declare
  v_response xmltype;
  v_response_code number(4);
  v_response_msg varchar2(64);
  v_xmltext varchar2(256);
  v_OutOfStockResponse xmltype := xmltype(
'<OutOfStockAdviceResponse xmlns="http://abc.org/abcWebServices"> 
  <OutOfStockAdviceResult>
    & lt;Response& gt;& lt;ResponseCode& gt;0& lt;/ResponseCode& gt;& lt;ResponseMessage& gt;Successful& lt;/ResponseMessage& gt;& lt;/Response& gt; 
  </OutOfStockAdviceResult>
</OutOfStockAdviceResponse>');
begin
  select extractValue(v_OutOfStockResponse,'/OutOfStockAdviceResponse/OutOfStockAdviceResult','xmlns="http://abc.org/abcWebServices"')
    into v_xmltext
    from dual;
   dbms_output.put_line('Text = ' || v_xmlText);
   v_response := xmltype(v_xmltext);
   v_response_code := v_response.extract('/Response/ResponseCode/text()').getnumberval();
   v_response_msg  := v_response.extract('/Response/ResponseMessage/text()').getstringval();
   dbms_output.put_line('Code = ' || v_response_code);
   dbms_output.put_line('Msg = ' || v_response_msg);
end;Note that like you I had to insert space characters between in the 'lt' and 'gt' escape sequences...
When this is run you get the following
SQL> set define off
SQL> set serveroutput on
SQL> --
SQL> declare
  2    v_response xmltype;
  3    v_response_code number(4);
  4    v_response_msg varchar2(64);
  5    v_xmltext varchar2(256);
  6    v_OutOfStockResponse xmltype := xmltype(
  7  '<OutOfStockAdviceResponse xmlns="http://abc.org/abcWebServices">
  8    <OutOfStockAdviceResult>
  9      & lt;Response& gt;& lt;ResponseCode& gt;0& lt;/ResponseCode& gt;& lt;ResponseMessage& gt;Successful& lt;/ResponseMessage& gt;& lt;/Response& gt;
10    </OutOfStockAdviceResult>
11  </OutOfStockAdviceResponse>');
12  begin
13    select extractValue(v_OutOfStockResponse,'/OutOfStockAdviceResponse/OutOfStockAdviceResult','xmlns="http://abc.org/abcWebServices"')
14      into v_xmltext
15      from dual;
16     dbms_output.put_line('Text = ' || v_xmlText);
17     v_response := xmltype(v_xmltext);
18     v_response_code := v_response.extract('/Response/ResponseCode/text()').getnumberval();
19     v_response_msg  := v_response.extract('/Response/ResponseMessage/text()').getstringval();
20     dbms_output.put_line('Code = ' || v_response_code);
21     dbms_output.put_line('Msg = ' || v_response_msg);
22  end;
23  /
Text =
<Response><ResponseCode>0</ResponseCode><ResponseMessage>Successful</ResponseMes
sage></Response>
Code = 0
Msg = Successful
PL/SQL procedure successfully completed.
SQL>Basically we extract the encoded text using extractValue() which will de-escape the escapted characters and then create a new XMLType which we can operate on

Similar Messages

  • ANSI escape sequence for "Command" key?

    I know there are escape sequences for ctrl (^), alt (~), shift ($), etc that can be used from the command-line, but I'm wondering if there's an equivalent way to invoke the command key (or the apple key or whatever you wish to call it) from a terminal?
    I'd appreciate any advice, thanks!

    Hi Evan,
       This is more than a failure of terminology. The use of certain key sequences cause the terminal to produce certain characters that are just like letters except that many processes take special action when these characters are encountered. These characters are called "control characters."
       For instance, type <Control>-v to "tell the shell" to not take special action on the next character produced. Then, if you type <Control>-c, the terminal will produce an End-of-Text character, ANSII character 3, and the shell will accept it as a literal character. However, it has no symbol for that character so it displays a pair of characters, "^C", in its place. Internally though, there is no carat and no 'C'; there is only the number three, which is the ANSII code for the End-of-Text character.
       The bash shell will substitute control characters for certain escape sequences in expanding words of the form $'string'. For instance, consider the following command:
    echo $'\003' | cat -v
    ^C
    Above, the first line is a command that you can cut-and-paste into your terminal. The second line is the output you would see if you execute the command. Bash replaces the $'\003' word with the literal control character and then "cat" converts that character to the pair of characters, "^C", to show you what had been there.
       Of course there are still terminology problems; you are not using the word "emulate" correctly. However, if there was such a meaning, I think that one would say that the character sequences "emulate" the control character, not the other way around.
       On the other hand, when you modify a key with the "Command" key, Macintosh programs treat that as an attempt to invoke a function of that program. No character is produced. In fact technically, the program never even sees the keystrokes. The system intercepts the key event and converts it to an AppleEvent.
       One tool on Macs specializes in producing AppleEvents and that is AppleScript. Fortunately, Apple wrote a utility to grant the shell access to AppleScript and that is the "osascript" command. That allows you to sort of imbed AppleScript in a shell script and that would allow you to send any program any event that the system would generate in response to a command key sequence.
    Gary
    ~~~~
       "Home life as we understand it is no more natural to us
       than a cage is to a cockatoo."
          -- George Bernard Shaw

  • PCL Escape Sequence for PDF417 barcodes

    I have purchased the HP Laserjet Font Solutions (HP Part HG271US) for my HP Color LaserJet CP4020 Series printer so that I can create shipping labels with scannable barcodes for our customers.  I am able to generate the PCL code and print out code 39 and code 128 barcodes.  When I print out the PCL font list, it shows the escape sequences for the code 39 and code 128 barcodes.  I need to print out pdf417 barcodes as well but I don't get any escape sequences on the PCL font list or a font ID for the pdf417 barcode. 
    Does anyone know what the escape sequence is for the PDF417 barcode when using the HP Laserjet Font Solutions (HP Part HG271US)?

    A translation of your PCL snippet for Code 128:
    <Esc>&a0P Print Direction: 0 degree rotation
    <Esc>&a3R Cursor Position Vertical (row 3)
    <Esc>&a0C Cursor Position Horizontal (column 0)
    <Esc>(9Y Primary Font: Symbol Set (identifier = 9Y)
    <Esc>(s1P Primary Font: Spacing: Proportional
    <Esc>(s30V Primary Font: Height (30 points)
    <Esc>(s0S Primary Font: Style (Upright, solid)
    <Esc>(s0B Primary Font: Stroke Weight: Medium
    <Esc>(s28687T Primary Font: Typeface (identifier = 28687)
    *VttbRackLabelInfo.SupplierCode*
     Note that I've changed the "(s30v" to "(s30V" to comply with PCL syntax rules.
    And a translation of your PDF417 snippet:
    <Esc>&a0P Print Direction: 0 degree rotation
    <Esc>&a8R Cursor Position Vertical (row 8)
    <Esc>&a113C Cursor Position Horizontal (column 113)
    <Esc>(9Y Primary Font: Symbol Set (identifier = 9Y)
    <Esc>(s1P Primary Font: Spacing: Proportional
    <Esc>(s50V Primary Font: Height (50 points)
    <Esc>(s0S Primary Font: Style (Upright, solid)
    <Esc>(s0B Primary Font: Stroke Weight: Medium
    <Esc>(sp Primary Font: Spacing: Fixed
    b Primary Font: Stroke Weight: Medium
    24850T Primary Font: Typeface (identifier = 24850)
    *ttbRackLabelInfo.PCISegment15*
     with the same correction as above; note also that you have specified (the same) stroke weight twice, and two different spacing attributes (the latest will apply).
    It's possible that other values for some of these attributes may have non-standard interpretations by the font DIMM (e.g. to specifiy PDF417 error-correction level).

  • What is escape sequence for * in SQL

    I am using oracle 9. When I run a select query with a where clause as
    AND UPPER (bnm.name_value_tx) LIKE '*/*%' ESCAPE '\'
    I got an exception as
    ORA-29902: error in executing ODCIIndexStart() routine ORA-20000: Oracle Text error: DRG-51030: wildcard query expansion resulted in too many terms ]; nested exception is java.sql.SQLException: ORA-29902: error in executing ODCIIndexStart() routine ORA-20000: Oracle Text error: DRG-51030: wildcard query expansion resulted in too many terms
    Is there any escape sequence to handle the character * in query? or any other solution to this problem?

    If what I understand in my limited knowledge is correct, then u want to search the character * or ** with any character after that as u have used %. But 1st of all, u dont need an escape character for * . Thats only required for _ and % if u use any of it as a search character. So go straight:
    AND UPPER (bnm.name_value_tx) LIKE '**%' ....
    (if u want to search for ** at the beginning of the field with any characters afterwards.)
    Use Escape Characters like:
    select first_name,job_id from employees where job_id like 'SA\_%' escape '\'

  • Handling DB sequences for create and commit actions on ADF tables

    Hello,
    Most of the tables will have sequences used for primary keys and there will be columns like created_On and created_By columns. But my table does not require user inputs for these columns. So when commit button is clicked on the table how to handle these columns. The commit action should refer the sequence and enter SYSDATE and username for created_on and created_by columns.
    what is the workaround for this ?
    Thanks.

    Use groovy expressions as default values for the EO fields - adf.currentDate and adf.context.securityContext.getUserName()
    For the sequence see the ADF documentation:
    http://docs.oracle.com/cd/E16162_01/web.1112/e16182/bcentities.htm#sm0147

  • Escape codes for substring and bold????

    i am writing a servlet to process a form i made with HTML.
    The servlet works with the form data and sends an e-mail.
    I use escape characters for returns, tabs and stuff like that. Is there a code to BOLD or SUPERSCRIPT a peice of the output?
    THANKS!

    The HTML code for bold is <b>bold</b>, if that's what you were asking. And there's <sub> too. If you weren't asking that, what were you asking?

  • Escape Sequences for HP Color LaserJet 3600n

    I want to be able to print a file to my 3600n printer with certain text printed in color. I print from a Fedora14 box. For output to the screen, I can use the well-known VT100 terminal escape sequences to achieve colored display, in, say, red. I want to achieve the same effect with printed files.
    Does the 3600n respond to escape sequences? If so, where can I find a list of these escape sequences?
    TIA,
      Jon

    This seems to be a commercial product. For the best chance at finding a solution I would suggest posting in the forum for HP Business Support!
    You can find the Commercial Laserjet board here:
    http://h30499.www3.hp.com/t5/Printers-LaserJet/bd-p/bsc-413
    Best of Luck!
    You can say thanks by clicking the Kudos Star in my post. If my post resolves your problem, please mark it as Accepted Solution so others can benefit too.

  • Xml SQL Utility for java and Dr.Watson for WIN-NT

    hello everybody.
    when i am running the sample code in xml Sql utility for java documentation,
    Dr. watson for windows NT error occures.
    what may be the problem? please suggest a solution
    thanks
    dev

    Set JDK_HOME to the directory where you install your JDK (Java Development Kit).
    So instance, I've install JDK1.1.8 on my
    C drive so
    set JDK_HOME=c:\jdk1.1.8;c:\jdk1.1.8\bin

  • Escape sequence for Bold, underline etc.

    Hi
    We are on EBS 11.5.10 using XML publisher to generate our Purchase orders. On the purchase orders we use standard functionality attachments type short text to specify special instructions etc. on the printed purchase order report. Some of these attachments may have a heading that should be in bold and some may not.
    Is there a way to include an escape/formatting sequence in the short text attachment, to control the formatting of the text directly?
    Your help is highly appreciated

    I doubt you can use Esc sequences inserted in the text to achieve this. Here is a work around. Use some kind of markup to indicate bold header in the text, if any. For example, use tags and . Then in the data model have two formula columns that would parse the text looking for the header and for the body. The first formula would return the header to be in bold (if any found), the second formula would return text to be printed plain. Then in the layout create two fields, and map then to the columns. The first field to be formatted as bold.

  • Where is the doc for xml task options for deploy and ojdeploy-build ?

    I am a new user.
    I tried using jdev help to find my answer, but got lost quickly in the zillions of manuals.
    1) Where is the manual/doc for the xml task attributes/options for the Ant tags <deploy> and <ojdeploy-build>?
    I am modifying an xml script that ojdeploy will call, but do not know what attributes/options are supported for these tags. I need to know whether an option such as failonerror exists, so that I can report a bug that <deploy> does not default to fail on error (or that <ojdeploy-build> ignores the error and continues with the script.
    Followup questions:
    2) How do I find the java code that implements the tags <deploy> and <ojdeploy-build>?
    3) How do I report a bug on the implementation for these tags and propose a fix (assuming I can see the java source code)?

    I guess I wasn't clear enough. What I tried to say was:
    1) Where is the manual/doc for the xml task attributes/options [I meant to say attributes/elements] for the Ant tags [I meant to say tasks] <deploy> and <ojdeploy-build>?
    I did not mean the ojdeploy command, but the Ant tasks <ojdeploy-build> and <deploy>.
    The jdev help does not seem to provide the complete list of elements or attributes for these critical Ant tasks, though it has a few examples.
    So far, it appears that <deploy> has been misdesigned and I cannot do what I want, which is to "failonerror" (failonerror="true" should be the default but the opposite is true and there is no attribute to change the setting).
    You could consider this to be a bad flaw in Ant itself, that you cannot get the exit code from every Ant task (since they are java programs they do have an exit code), so when new tasks are implemented by folks who lack experience they may leave out access to this programming feature that is however implemented for a bunch of important core Ant tasks such as "java" or "exec". It would have been far more useful to make this a generic feature of all Ant tasks. Of course then folks would be asking for stuff like "fail if" or "fail unless" and where would it end? Maybe with a real programming language like TCL but in XML form.

  • Prepping a Sequence for Web/and EXporT

    Any link or answer to this- i'm preparing a 2 minute trailer for web. what are the settings necessary in final cut to prepare for the quicktime export. Also once in a quicktime format what should the export settings coming out. currently have final cut hd we want a relatively fast download time for accessing but want not to sacrifice too much quality. thanks for any help.
    mel

    But...can h.264 be viewed on most computers?
    No. QT7 h264 is not very well pentrated yet. All iPod/iTunes users have it but few business machines will have it. Furthermore, many larger companies don't allow employees to install it even if they need it.
    For Quicktime content, I can reach the broadest audience with Sorenson 3 compression. It was introduced in QuickTime 5 a long time ago. If I want to go a bit more recent, I use the 3ivx version of MP4 compression. Download the free 3ivx plugin at 3ivx.com. This works on any computer that supports MP4 but it looks better than the Apple mp4 CODEC.
    MPEG-1 is the most universal web video format, but the filesize will be about 3x bigger than anything more modern.
    WMV-9 is also a popular way to post video. At the risk of being run off this forum, I'll just say that it's market pentration is vastly wider than QuickTime and the quality is comparable to MP4. I use an affordable QuickTime plugin called Popwire WMV-9 Export 1.1 to export directly to this format from Final Cut.
    Also don't rule out Flash Spark video format. Users of Flash 8 Plugin can view this format and I know there are many machines with this capability. You need flash pro to do this format.

  • Host command - escape sequence for BEEP

    I have successfully entered the following command on SQL*Plus:
    SQL> Host Echo ^G
    That is what it appears as, but when I enter it is the <CTRL>G. The box BEEPS. I want to do this because a long query is running and I want it to BEEP at me after it is done.
    If I type it as a literal ^ (shifted 6 character) plus the G, it looks the same on the screen, but simply echos a G without the ^.
    The command works fine. I just want to know how to enter it into a script. Typing <CTRL>G in notepad doesn't work.
    Thanks for any ideas.

    In case this is of any use to my fellow Vimmers, I've found I can't live without the following basics in my _vimrc / .vimrc:
    set ignorecase
    map = :e#
    map ^N :n
    map ^W :w
    map <F2> :let @/ = "" <CR><C-L>
    set guifont=Lucida_Console:h9:cANSI
    set directory=c:\tmp,c:\temp
    set backupdir=c:\tmp,c:\temp
    set columns=111
    set lines=50The ^N and ^W are the actual control characters. The F2 remapping clears the yellow highlighting after a search.
    I'm also working on setting the colours up so they are bit better and updating the woeful supplied SQL / PL/SQL syntax files.

  • Can I use Multiple Sequences for DV and H.264?

    I have half my video in FCE as DV and sequence set to 720x480. The other half is H.264 1280x720. Can I make a second sequence? If so, then do I combine the two with a final sequence set to 720p?
    Thanks,
    Rod

    You coud but the DV sequence would be half the size of the HD sequence and would appear as a small box inside the HD sequence. Or you could place the HD squence in the standard definition sequence, scaling it down. There might still be an issue if the aspect ratios are different. The HD sequence would appear letterboxed in a standard 4:3 sequence.

  • XML assign style for numbered and bullet lists

    Hi,
    This is kinda a continuation from my previous thread. I understand that XSLT has to be used to transform the previous elements to be able to use ID paragraph styles. I would think the same would have to be acoomplished for lists.
    Is it possible with paragraph styles to generate the same results as a list in HTML? Or would I have to create individual paragraph styles for each nested list?
    I hope I'm making sense.
    Like:
    <h5>Nested unordered list</h5>
    <li1>bullet list</li1>
    <li1>bullet list</li1>
    <li2>bullet list</li2>
    <li2>bullet list</li2>
    <li3>bullet list</li3>
    <li3>bullet list</li3>
    <li4>bullet list</li4>
    <li4>bullet list</li4>
    Sample HTML:
    <h5>Nested unordered list</h5>
    <ul>
    <li>bullet list</li>
    <li>bullet list</li>
    <ul>
    <li>bullet list</li>
    <li>bullet list</li>
    <ul>
    <li>bullet list</li>
    <li>bullet list</li>
    <ul>
    <li>bullet list</li>
    <li>bullet list</li>
    </ul>
    </ul>
    </ul>
    </ul>
    <h5>Nested ordered list</h5>
    <ol>
    <li>ordered list</li>
    <li>ordered list</li>
    <ol type="a">
    <li>ordered list</li>
    <li>ordered list</li>
    <ol type="i">
    <li>ordered list</li>
    <li>ordered list</li>
    <ol type="A">
    <li>ordered list</li>
    <li>ordered list</li>
    <ol type="I">
    <li>ordered list</li>
    <li>ordered list</li>
    </ol>
    </ol>
    </ol>
    </ol>

    I think the best way is to create a new paragraph style for each nested level.
    Example:
    Create a new style for each sub level.
    Text here
    Text here
    Sub level 1
    Sub level 1
    Thanks...

  • Can not rename extracted image with extract for bracket. How to fix this ?

    when i try to renmae  and enter , it cretes new line
    how to renmae and change extension of image ?

    Thanks, John T Smith for you suggestion. And its a upcoming feature of BRACKET and ADOBE EXTRACT which is not now available. I've created an issue on GitHub and got responsose there.

Maybe you are looking for

  • How can I run 2 Dreamweaver windows at the same time?

    How can I run 2 Dreamweaver windows at the same time on my PC? basically I have 2 monitors and I want to edit CSS on one monitor and have the html page open on the other so I can quickly look from one to another with in a split second instead of taki

  • How to i copy my i photos on my mac to my mac laptop

    How do I copu my i photo from my mac to my mac laptop

  • How to calculate some value that referring to another table

    Hi... Need help asap The questions are : Q1 : In Microsoft Excell, we can take value from one cell and use it to another cell. How about in BO, if we want to take value (ex. 93.75) from the other table and use or refer the value that we want to to an

  • Upload probleb

    Hi, I have to upload the data in time infotype 2011. I am using BDC using session method. The prog runs withour giving any error, but the data is not uploaded in the infotype. The data gets stored in TEVEN table if you manuualy create the record. Reg

  • Can a US resident purchase from a non-US Music Store?

    When I (a US resident) attempt to purchase from the French or Italian Music Stores, I get the following message: "Your account is only valid for purchases in the US Music Store. Clicking OK will take you to this store." (1) Is there any way I can ame