Extract data from XML (merged) [message #542715] |
Thu, 09 February 2012 22:09 |
muralikri
Messages: 638 Registered: August 2011 Location: chennai
|
Senior Member |
|
|
How to extract the data from xml using the xsd file. attached files.
Explanation: first check the EmailMessage tage from order_conf.xml compared with Email.xml(<xsd:element name="EmailMessage">) if exists then go to next node.
EmailMessage(exists tag in order xml file)
->next <ns1:emailNotificationype> this tag should be follow under the EmailMessage tag(<xsd:element ref="emailNotificationype">) in Email.xml
->next <ns1:orderNotification> -> check this tag in <xsd:element name="orderNotification"> in Email.xml.
-> next <ns1:templateFormatInfo> -> it should follow under <xsd:element name="orderNotification"> in Email.xml.
-> next <ns1:templateFormatInfo> -> it should follow these tages <xsd:element name="templateFormatInfo"> <xsd:element ref="templatecode"/>
<xsd:element ref="templateversion"/>
i have to extract the value in between tags.
templatecode -> ORDCONF
templateversion ->1.0
Finally i have to load the data into table
Thanks,
[Updated on: Thu, 09 February 2012 22:14] by Moderator Report message to a moderator
|
|
|
|
|
|
|
|
11.1.0.6.0 [message #542838 is a reply to message #542715] |
Fri, 10 February 2012 06:25 |
muralikri
Messages: 638 Registered: August 2011 Location: chennai
|
Senior Member |
|
|
Hi All,
I have loaded the data into table as below and want extract data from xml file. Please help me.
Find the xml file.
Thanks,
CREATE TABLE TABLE_WITH_XML_COLUMN
(
XML_DOCUMENT XMLTYPE
)
INSERT INTO table_with_xml_column VALUES
(XMLType(bfilename('<<DIRECTORY_NAME>>', 'test1.xml'),nls_charset_id('AL32UTF8')));
commit;
-
Attachment: test1.txt
(Size: 7.67KB, Downloaded 2410 times)
[Updated on: Fri, 10 February 2012 06:33] by Moderator Report message to a moderator
|
|
|
|
|
|
Re: 11.1.0.6.0 [message #542844 is a reply to message #542842] |
Fri, 10 February 2012 07:11 |
muralikri
Messages: 638 Registered: August 2011 Location: chennai
|
Senior Member |
|
|
i am doing like...
it's not working.....
select extractvalue(xml_document,
'/EmailMessage/emailNotificationype/orderNotification/templateFormatInfo/templatecode')
AS tspace_name
from table_with_xml_column
[Updated on: Fri, 10 February 2012 07:38] by Moderator Report message to a moderator
|
|
|
|
|
|
|
|
Re: 11.1.0.6.0 [message #543012 is a reply to message #542883] |
Sun, 12 February 2012 09:39 |
|
Barbara Boehmer
Messages: 9103 Registered: November 2002 Location: California, USA
|
Senior Member |
|
|
SCOTT@orcl_11gR2> COLUMN templatecode FORMAT A15
SCOTT@orcl_11gR2> COLUMN templateversion FORMAT A15
SCOTT@orcl_11gR2> SELECT EXTRACTVALUE
2 (x.column_value,
3 '//templatecode',
4 'xmlns:ns1="http://integration.sprint.com/v2/public/interfaces/EnterpriseEmail/EmailMessage.xsd"
5 xmlns="http://integration.sprint.com/v2/public/interfaces/EnterpriseEmail/EmailMessage.xsd"')
6 AS templatecode,
7 EXTRACTVALUE
8 (x.column_value,
9 '//templateversion',
10 'xmlns:ns1="http://integration.sprint.com/v2/public/interfaces/EnterpriseEmail/EmailMessage.xsd"
11 xmlns="http://integration.sprint.com/v2/public/interfaces/EnterpriseEmail/EmailMessage.xsd"')
12 AS templateversion
13 FROM TABLE
14 (XMLSEQUENCE
15 (EXTRACT
16 (XMLTYPE (BFILENAME ('MY_DIR', 'test1.xml'), NLS_CHARSET_ID ('AL32UTF8')),
17 '//EmailMessage',
18 'xmlns:ns1="http://integration.sprint.com/v2/public/interfaces/EnterpriseEmail/EmailMessage.xsd"
19 xmlns="http://integration.sprint.com/v2/public/interfaces/EnterpriseEmail/EmailMessage.xsd"'))) x
20 /
TEMPLATECODE TEMPLATEVERSION
--------------- ---------------
ORDCONF 1.0
1 row selected.
|
|
|
|