Parsing XML [message #642067] |
Tue, 01 September 2015 15:38 |
Duane
Messages: 581 Registered: December 2002
|
Senior Member |
|
|
Any idea on how to get the value of "ns:return"? The value returned should be "0066012c76be4260b4b3f466b20e8be0"
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soapenvelope">
<soapenv:Body>
<ns:initializeResponse xmlns:ns="http://context.ws.blackboard">
<ns:return>0066012c76be4260b4b3f466b20e8be0</ns:return>
</ns:initializeResponse>
</soapenv:Body>
</soapenv:Envelope>
Been trying this:
resp_extract xmltype;
resp_extract := resp.extract('/soapenv:Envelope/soapenv:Body/child::node()', 'xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"');
I think if someone could show me how it's done then I'll understand what values to plug into where.
|
|
|
Re: Parsing XML [message #642108 is a reply to message #642067] |
Wed, 02 September 2015 14:33 |
|
Barbara Boehmer
Messages: 9103 Registered: November 2002 Location: California, USA
|
Senior Member |
|
|
This may not be the most efficient method. I was just trying to come as close as I could to the method it looks like you are trying to use and get the desired result.
SCOTT@orcl> declare
2 resp xmltype;
3 resp_extract xmltype;
4 begin
5 resp := xmltype
6 ('<?xml version=''1.0'' encoding=''utf-8''?>
7 <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soapenvelope">
8 <soapenv:Body>
9 <ns:initializeResponse xmlns:ns="http://context.ws.blackboard">
10 <ns:return>0066012c76be4260b4b3f466b20e8be0</ns:return>
11 </ns:initializeResponse>
12 </soapenv:Body>
13 </soapenv:Envelope>');
14 resp_extract := resp.extract
15 ('/soapenv:Envelope/soapenv:Body/child::node()/ns:return/child::node()',
16 'xmlns:soapenv="http://www.w3.org/2003/05/soapenvelope"
17 xmlns:ns="http://context.ws.blackboard"');
18 dbms_output.put_line (resp_extract.getclobval);
19 end;
20 /
0066012c76be4260b4b3f466b20e8be0
PL/SQL procedure successfully completed.
[Updated on: Wed, 02 September 2015 14:39] Report message to a moderator
|
|
|
Re: Parsing XML [message #642109 is a reply to message #642108] |
Wed, 02 September 2015 14:39 |
Duane
Messages: 581 Registered: December 2002
|
Senior Member |
|
|
That works. Thanks.
By the way, do you know how to get a time stamp in the following format?
2015-09-08T09:46:48.484Z
<wsu:Created>2015-09-08T09:46:48.484Z</wsu:Created>
<wsu:Expires>2015-09-08T09:47:48.484Z</wsu:Expires>
The dateTime data type is used to specify a date and a time.
The dateTime is specified in the following form "YYYY-MM-DDThh:mm:ss" where:
YYYY indicates the year
MM indicates the month
DD indicates the day
T indicates the start of the required time section
hh indicates the hour
mm indicates the minute
ss indicates the second
[Updated on: Wed, 02 September 2015 14:39] Report message to a moderator
|
|
|
|
|
Re: Parsing XML [message #642113 is a reply to message #642112] |
Wed, 02 September 2015 15:42 |
Duane
Messages: 581 Registered: December 2002
|
Senior Member |
|
|
Last one is what I need but it would appear I need GMT.
Something like this:
replace(TO_CHAR (CAST (systimestamp AT TIME ZONE 'GMT' AS TIMESTAMP ( 3 )), 'rrrr-mm-dd hh24:mi:ss.ff'),' ','T')||'Z'
I'm sure you can come up with something better.
|
|
|
|
|
|