Parse XML Elements/Attributes from CLOB in PL/SQL
Hi folks,
I'm new to XML development in Oracle...I need some help in Parsing a XML stored in a CLOB column using PL/SQL.
We are using Oracle 9i R2. Do i need install the XDK and /or XML DB?
Basically the xml has some quiz questions and the answers to the quiz. Once student submits the quiz we need parse the XML and calculate the grade.
Any help is appreciated...
Thanks,
A bit dirty but this works:
Create an XMLType based on the CLOB contents...
select extractvalue(value(x), '/PERSON/PER_ID/text()') PER_ID, extractvalue(value(x), '/PERSON/PER_ID/@changed') PER_ID_CHG
, extractvalue(value(x), '/PERSON/SURNAME/text()') PER_SURNAME, extractvalue(value(x), '/PERSON/SURNAME/@changed') PER_SURNAME_CHG
, extractvalue(value(x), '/PERSON/ADDRESS/STREET_NO/text()') PER_STREET_NO, extractvalue(value(x), '/PERSON/ADDRESS/STREET_NO/@changed') PER_STREET_NO_CHG
, extractvalue(value(x), '/PERSON/ADDRESS/POSTCODE/text()') PER_POSTCODE, extractvalue(value(x), '/PERSON/ADDRESS/POSTCODE/@changed') PER_POSTCODE_CHG
from table(xmlsequence(extract(xmltype('
<PERSON>
<PER_ID changed="1">260180</PER_ID>
<SURNAME changed="2">MARTIN</SURNAME>
<ADDRESS>
<STREET_NO changed="3">1</STREET_NO>
<POSTCODE changed="4">LE3 8RA</POSTCODE>
</ADDRESS>
</PERSON>')
, 'PERSON')
) x;
Similar Messages
-
Parse XML Elements/Attributes from CLOB into Oracle Table
Hi!
I have an XML file (loaded into a CLOB) which I need to parse and have each individual element and attribute inserted into an oracle table for manipulation.
Eg: XML File...
<PERSON>
<PER_ID changed="1">1</PER_ID>
<SURNAME changed="1">MARTIN</SURNAME>
<ADDRESS>
<STREET_NO changed="1">1</STREET_NO>
<POSTCODE changed="1">LE3 8RA</POSTCODE>
</ADDRESS>
</PERSON>
There will only ever be one address.
From this I need to extract
* PER_ID and related changed attribute
* SURNAME and related changed attribute
* STREET_NO and related changed attribute
* POSTCODE and related changed attribute
and insert a single record into the table below:
CREATE TABLE PERSON AS
( PER_ID VARCHAR2(10)
, ID_CHANGED VARCHAR2(1)
, SURNAME VARCHAR2(30)
, ID_CHANGED VARCHAR2(1)
, STREET_NO VARCHAR2(5)
, ID_CHANGED VARCHAR2(1)
, POSTCODE VARCHAR2(10) );
Any assistance/advice would be very much appreciated. I've tried using DBMS_XMLSave / DBMS_XMLStore which works great at pulling in elements (PER_ID, SURNAME, etc) straight into the table but doesn't look at the changed attributes, and I need both.
Thanks a million in advance to anyone who can crack this!!
JayTry looking at this thread
Loading datafrom a PL/SQL table into the Database table -
How to Parse XML Store in a CLOB in a SQL
I'm rather new in using XML concepts in a SQL. Here is my dilemma:
I have a table with following definition:
CREATE TABLE extension
extension_id NUMBER(10) NOT NULL,
extension_content CLOB NOT NULL,
fk_transaction_id NUMBER(10),
fk_batch_id NUMBER(10)
Where XML format type data is stored and here is sample of data there:
INSERT INTO EXTENSION ( EXTENSION_ID, EXTENSION_CONTENT, FK_TRANSACTION_ID,
FK_BATCH_ID ) VALUES (
300, '<Extension>
<controlNumber>5070</controlNumber>
<depositDate1>031105</depositDate1>
<depositDate2>031105</depositDate2>
<recordType>7</recordType>
<sequenceNo>1</sequenceNo>
<statementNo>B5653047</statementNo>
</Extension>'
, 207, NULL);
INSERT INTO EXTENSION ( EXTENSION_ID, EXTENSION_CONTENT, FK_TRANSACTION_ID,
FK_BATCH_ID ) VALUES (
301, '<Extension>
<controlNumber>5070</controlNumber>
<depositDate1>031105</depositDate1>
<depositDate2>031105</depositDate2>
<recordType>7</recordType>
<sequenceNo>2</sequenceNo>
<statementNo>B5653047</statementNo>
</Extension>'
, 208, NULL);
INSERT INTO EXTENSION ( EXTENSION_ID, EXTENSION_CONTENT, FK_TRANSACTION_ID,
FK_BATCH_ID ) VALUES (
586, '<Extension>
<controlNumber>5157</controlNumber>
<headerId>ID UEA13700 CLASS C NAME</headerId>
<recordType>7</recordType>
</Extension>'
, NULL, 538);
INSERT INTO EXTENSION ( EXTENSION_ID, EXTENSION_CONTENT, FK_TRANSACTION_ID,
FK_BATCH_ID ) VALUES (
290, '<Extension>
<depositDate>40521</depositDate>
<destination exception="empty"></destination>
<x1Number>845734</x1Number>
<origin>21000021</origin>
<overflowCount>0</overflowCount>
</Extension>'
, NULL, 217);
Could you kindly help me to write a SQL which will retrieve the first rows where there are <controlNumber>, <depositDate1> and <depositDate2> in the column as?:
SELECT extension_id, ?extension_content? controlnumber, ??extension_content?? depositdate1, ???extension_content??? depositdate3 FROM Extension
WHERE...
The only way I could do was using several SUBSTR and INSTR on TO_CHAR(extension_content) which I don't think was a good way.
Thank you very much in advance for your help and your sample example.
Adam Tadj.if you want to do it with SQL you should change the data type of the EXTENSION_CONTENT from CLOB to XMLTYPE so that you can treat the content in the column as XML and use functions (EXTRACT, EXTRACTVALUE etc...) available in the database to retrieve what you want.
but for this your database version should be atleast 9.2.0.4 and above.
here is the modified example.
CREATE TABLE extension
extension_id NUMBER(10) NOT NULL,
extension_content XMLTYPE NOT NULL,
fk_transaction_id NUMBER(10),
fk_batch_id NUMBER(10)
INSERT INTO EXTENSION ( EXTENSION_ID, EXTENSION_CONTENT, FK_TRANSACTION_ID,
FK_BATCH_ID ) VALUES (
300, xmltype('<Extension>
<controlNumber>5070</controlNumber>
<depositDate1>031105</depositDate1>
<depositDate2>031105</depositDate2>
<recordType>7</recordType>
<sequenceNo>1</sequenceNo>
<statementNo>B5653047</statementNo>
</Extension>')
, 207, NULL);
INSERT INTO EXTENSION ( EXTENSION_ID, EXTENSION_CONTENT, FK_TRANSACTION_ID,
FK_BATCH_ID ) VALUES (
301, xmltype('<Extension>
<controlNumber>5070</controlNumber>
<depositDate1>031105</depositDate1>
<depositDate2>031105</depositDate2>
<recordType>7</recordType>
<sequenceNo>2</sequenceNo>
<statementNo>B5653047</statementNo>
</Extension>')
, 208, NULL);
INSERT INTO EXTENSION ( EXTENSION_ID, EXTENSION_CONTENT, FK_TRANSACTION_ID,
FK_BATCH_ID ) VALUES (
586, xmltype('<Extension>
<controlNumber>5157</controlNumber>
<headerId>ID UEA13700 CLASS C NAME</headerId>
<recordType>7</recordType>
</Extension>')
, NULL, 538);
INSERT INTO EXTENSION ( EXTENSION_ID, EXTENSION_CONTENT, FK_TRANSACTION_ID,
FK_BATCH_ID ) VALUES (
290, xmltype('<Extension>
<depositDate>40521</depositDate>
<destination exception="empty"></destination>
<x1Number>845734</x1Number>
<origin>21000021</origin>
<overflowCount>0</overflowCount>
</Extension>')
, NULL, 217);
set linesize 1000
column extension_id format 999999
column controlnumber format 999999
select EXTENSION_ID
,extractvalue(EXTENSION_CONTENT, '/Extension/controlNumber') ControlNumber
,extractvalue(EXTENSION_CONTENT, '/Extension/depositDate') DepositDate
from extension
/ -
Pixel-Positions in XML-Element attributes
hi,
is there a way, when attaching a xml-tag to e.g. a picture, that the top and left pixel value is saved in a xml-element attribute? the pixel value from top and from the left.
thanks in advance.
regards.hi,
is there a way, when attaching a xml-tag to e.g. a picture, that the top and left pixel value is saved in a xml-element attribute? the pixel value from top and from the left.
thanks in advance.
regards. -
How to remove elements/attributes from XML using Xpath in XSLT ??
Hello ,
Is there anyway or method of Xpath from which I can delete the elements and attributes from XML at runtime ??
Like I have such XML and I have to remove per attribute highlighted below
<person per="and">
<e:emp a="ir" b="ad" >
</e:emp>
</person>
And want a result like this
<person>
<e:emp a="ir" b="ad" >
</e:emp>
</person>
ThanksTo achieve this you can use the bpelx:remove function: http://download.oracle.com/docs/cd/E12483_01/integrate.1013/b28981/manipdoc.htm#CIHJBJFD
your assign will look like:
<bpel:assign>
<bpelx:remove>
<target variable="person" query="/person/@per" />
</bpelx:remove>
</bpel:assign>
Regards,
Melvin -
How to parse XML string fetched from the database
i want to parse the XML string which is fetched from the oracle database.
i have inserted the string in xml format in the database. The type of the field in which it is inserted is varchart2.
I am successfully getting it using jdbc, storing it in a String.
Now it is appended with xml version 1.0 and string is ready for parsing.
Now i am making following programming.
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = Builder.parse(xmlString);
Element root = doc.getDocumentElement();
NodeList node = root.getElementsByTagName("product");
But i am getting IOException at the statement
Document doc = Builder.parse(xmlString);
there fore i request u to kindly help me in solving this error.
-regards
pujanDocumentBuilder does not have a method parse with xml string as aparameter. The string should be a xml document uri.
Convert xml string to StringReader.
parse(new InputSource(new StringReader(xmlString))); -
JS: how can find role in XML element attribute
Dear All,
We could gather "footnote" XML elements as an array. But we need to filter the elements which has "role=endnote" in the attributes from the group of common footnote tagged elements .
Eg. <footnote xml:id="en2" label="2" role="endnote"> from myGetXMLElements("//footnote")
Kindly assist to get footnote XML elements which has the role "endnote".
regards
MasthanHi Fred,
Yes, I got it. Thanks
regards
Masthan -
How to Parse XML data directly from context variables in webdynpro
Hello,
I have two requirements:
1) I have a context variable which has string value.
I want to write the this value into a flat file.
How do I do this in WebDynpro.
Any sample code for this.
2) In Webdynpro, I want to parse and process the XML data directly from a string context variable which
has the value in XML format.
How do I achieve this. Any pointers or sample codes for this.
Thanks and Regards,
Anupama.Anupama,
Here is some link which talks about unpacking xml and converting to HTML.
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/eb/3dfb402eb5f76fe10000000a1550b0/content.htm">http://help.sap.com/saphelp_nw04/helpdata/en/eb/3dfb402eb5f76fe10000000a1550b0/content.htm</a>
I have done something like this in portal development and not in webdynpro.But in principle it should work very where. -
Getting xml document out from clob
Hi All,
How could we get the xml document according to the user queries if we store the xml document as it is to the clob.
Can I use the XSU to store the xml document to the clob and retrieve xml from the clob according to user queries.Is it possible?
How could intermedia help me in solving this problem.
Thanks in advance
Dinu Varghese.
nullOTN has some sample apps that might interest you:
[list]
[*]Customizing Web Content
[*]B2B with XML
[list]
Regards,
-rh -
Parsing XML data stored as CLOB in DB and save attribute values in table
Hello,
I have a CLOB column in table that is holding XML data as follows,
<banners>
<banner-image id="0">
<type>BANNER</type>
<local-path>http.gif</local-path>
<click-through-url>www</click-through-url>
<make>Acura</make>
</banner-image>
<banner-image id="1">
<type>BANNER</type>
<local-path>http.gif</local-path>
<click-through-url>gfrty</click-through-url>
<make>BMW</make>
</banner-image>
</banners>
Now I need to parse thru the above XML data and pull the attribute values to store in another table as follows,
BANNER_IMAGE_ID | TYPE | LOCAL_PATH | CLICK_URL | MAKE
0 | BANNER | http.gif | www | Acura
1 | BANNER | http.gif | gfrty | BMW
And XML data doesn't always end up with 2 rows in this table....some times it may be 3 or 4 as well. It is just that in this example it ended up with 2 rows.
So, I would appreciate if someone can help me find a generic way of doing this,
Thank you in advance,
Madhu.This is not a reply.. sorry.
I took have a similar problem only..
can you pls help me
XML structure.
<PODetails>
<POHeader>
<CurrencyID>INR</CurrencyID>
<ExchangeRate>1</ExchangeRate>
<RefNo>0080000110</RefNo>
<VendorID>1200</VendorID>
<TransDate>2006-12-20</TransDate>
<DocRelationshipId>PURCHASE</DocRelationshipId>
<LocationID>0000102327</LocationID>
</POHeader>
<POItemDetails>
<ItemID>ARSH1332</ItemID>
<Size>L HS</Size>
<Quality>Q1</Quality>
<CustPO>rush order</CustPO>
<UOM>PC</UOM>
<Quantity>3.000</Quantity>
<PriceValue>2509.5</PriceValue>
<TaxAmount>0.00</TaxAmount>
</POItemDetails>
<POItemDetails>
<ItemID>ARSH1332</ItemID>
<Size>M HS</Size>
<Quality>Q1</Quality>
<CustPO>rush order</CustPO>
<UOM>PC</UOM>
<Quantity>2.000</Quantity>
<PriceValue>1673</PriceValue>
<TaxAmount>0.00</TaxAmount>
</POItemDetails>
<POItemDetails>
<ItemID>ARSH1556</ItemID>
<Size>39FS</Size>
<Quality>Q1</Quality>
<CustPO>rush order</CustPO>
<UOM>PC</UOM>
<Quantity>1.000</Quantity>
<PriceValue>836.5</PriceValue>
<TaxAmount>0.00</TaxAmount>
</POItemDetails>
</PODetails>
The DB is ORACLE 9i
This is stored in a XML table of type XMLTYPE.
THIS I USED THE .extract function to get the values of the nodes.
POHeader details are working fine. But when i get the POItemDetails i am getting 'ARSH1332ARSH1332ARSH1556' when i issue the command
select a.extract('/PODetails/POItemDetails/ItemID/text()').getStringVal() ItemID
FROM xmltable a
WHERE a.existsnode('//POItemDetails/ItemID')=1
Pls Help..
Regds,
Santhoshkumar.G. -
Memory problem when store xml into XMLDB from CLOB source
Hi,
We have performed a stress test and looped the following
stored procedures for 1500 XML documents.
We found the UGA and PGA memory for this oracle process increased tremendously.
PGA memory
==========
6MB -> 2.9GB
UGA memory
==========
5MB -> 2.8GB
We have also experienced ORA-4030 error when more XML documents were inserted.
The PGA & UGA memory would not ever be released. We have checked that
the PGA & UGA memory for this process are still 2.9GB & 2.8GB the day after the stress test.
Stored Procedure
================
create or replace procedure clob_to_xml (indocid IN NUMBER) AS
clobdoc clob := EMPTY_CLOB();
myParser dbms_xmlparser.Parser;
indomdoc dbms_xmldom.domdocument;
xsltdomdoc dbms_xmldom.domdocument;
xsl dbms_xslprocessor.stylesheet;
outdomdocf dbms_xmldom.domdocumentfragment;
outnode dbms_xmldom.domnode;
outclobdoc clob := EMPTY_CLOB();
proc dbms_xslprocessor.processor;
xsltpath doc_types.canonical_doc_trim_xslt_name%type;
xmltabname doc_types.xmldb_table_name%type;
doc_type doc_types.doc_type%type;
doc_type_version doc_types.doc_type_version%type;
category doc_types.category%type;
sqlstring varchar2(500);
outxmldoc xmltype;
begin
-- clobdoc := :new.canonical_doc_content;
begin
select canonical_doc_content into clobdoc
from canonical_doc
where dttn_doc_id = indocid;
exception
when no_data_found then raise_application_error(-20001,'Doc ID ' || indocid || ' cannot be found');
when others then raise;
end;
begin
select dt.canonical_doc_trim_xslt_name, dt.xmldb_table_name, ddi.doc_type,ddi.doc_type_version, dt.category
into xsltpath, xmltabname, doc_type, doc_type_version, category
from
dttn_doc_info ddi,
doc_types dt
where ddi.dttn_doc_id = indocid
and ddi.doc_type = dt.doc_type
and ddi.doc_type_version = dt.doc_type_version;
exception
when no_data_found then raise_application_error(-20001,'Doc Type is not defined');
-- when others then raise;
end;
if (category <> 0 ) then
--only support business document at this moment
return;
end if;
if (xsltpath is null or xsltpath = '') then
raise_application_error (-20001,'XSLT is not defined on doc_type table - ' || doc_type);
end if;
if (xmltabname is null or xmltabname = '') then
raise_application_error (-20001,'XMLTable is not defined on doc_type table - ' || doc_type);
end if;
myParser := dbms_xmlparser.newParser;
dbms_xmlparser.parseClob(myParser, clobdoc);
indomdoc := dbms_xmlparser.getDocument(myParser);
dbms_xmlparser.parseClob(myParser, xdbURIType(xsltpath).getClob());
xsltdomdoc := dbms_xmlparser.getDocument(myParser);
xsl := dbms_xslprocessor.newstylesheet(xsltdomdoc, '');
proc := dbms_xslprocessor.newProcessor;
--apply stylesheet to DOM document
outdomdocf := dbms_xslprocessor.processxsl(proc, xsl, indomdoc);
outnode := dbms_xmldom.makenode(outdomdocf);
-- PL/SQL DOM API for XMLType can be used here
dbms_lob.createTemporary(outclobdoc, true);
dbms_xmldom.writeToClob(outnode, outclobdoc);
begin
sqlstring := 'INSERT INTO ' || xmltabname || ' values (:1, :2)';
EXECUTE IMMEDIATE sqlstring USING indocid, outxmldoc;
exception
when others then
begin
rollback;
raise_application_error (-20001,'Cannot insert into XMLDB , docid = ' || indocid);
end;
end;
dbms_lob.freeTemporary(outclobdoc);
DBMS_XMLDOM.freeDocument(indomdoc);
DBMS_XMLDOM.freeDocument(xsltdomdoc);
DBMS_XMLDOM.freeDocFrag(outdomdocf);
DBMS_XMLPARSER.freeParser(myParser);
DBMS_XSLPROCESSOR.freeProcessor(proc);
end;
Is there anything wrong with the Stored Procedure ?
My oracle version is 10.1.0.4.
Thanks & Regards,
NMMark,
I think you missed it. OP gave you the version.
My oracle version is 10.1.0.4.Rahul. -
XML element attributes in program
I am using following FMs to create XML document from internal table
CALL FUNCTION 'SDIXML_DATA_TO_DOM'
CALL FUNCTION 'SDIXML_DOM_TO_XML'
My internal table has field 'AMT' and generated XML file has following line
<AMT>1000</AMT>
But I want this line to be generated as <AMT Ccy = 'USD'>1000</AMT>
I tried to use set_attribute method of element but not able to get this.I should be missing somethig as I am new to this XML.
Can anyone please advsie how I can get this?
Thanks for your help.
SrinivasHello Srinivas
Below you see sample coding that I use on SAP-PI to map attributes into the XML stream (INVOIC IDoc)::
NOTE: mo_document is of TYPE REF TO if_ixml_document (which is exported as DATA_AS_DOM by fm SDIXML_DATA_TO_DOM).
METHOD MAP_SD_DOC_CAT_AND_BILL_TYPE.
* define local data
DATA: ld_billingdoc TYPE bapivbrkout-billingdoc,
ld_billing_type type bapivbrkout-bill_type,
ld_sd_doc_category TYPE vbtyp,
ld_edi_qualifier TYPE string.
" Location code mapping only for outbound invoices, i.e.
" invoices sent by subsidiary to its customers
CHECK ( is_outbound_invoic( ) = abap_true ).
CALL METHOD zcl_edi_idoc_invoic_services=>get_billingdoc_detail
EXPORTING
param = mif_param
* id_idocnumber =
id_rfc_destination = md_rfcdest
IMPORTING
ed_billingdoc = ld_billingdoc
ed_billing_type = ld_billing_type
ed_sd_doc_category = ld_sd_doc_category
ed_edi_qualifier = ld_edi_qualifier.
* NOTE: We add the SD document category and the EDI qualifier
* as attributes to E1EDK01/BELNR.
** <E1EDK01 SEGMENT="1">
** <CURCY>EUR</CURCY>
** <HWAER>EUR</HWAER>
** <WKURS>1.00000</WKURS>
** <ZTERM>T60F</ZTERM>
** <EIGENUINR>nnn</EIGENUINR>
** <BSART>INVO</BSART>
** <BELNR SD_DOC_CATEGORY="O" EDI_QUALIFIER="381" BILL_TYPE="ZOII">
** 1010010911
** </BELNR>
** <NTGEW>97.662</NTGEW>
** <BRGEW>127.239</BRGEW>
** <GEWEI>KGM</GEWEI>
** <FKART_RL>LR</FKART_RL>
** <RECIPNT_NO>0000823305</RECIPNT_NO>
** <FKTYP>L</FKTYP>
** </E1EDK01>
DATA: ld_name TYPE string,
ld_value TYPE string,
ld_rc TYPE i,
lo_node TYPE REF TO if_ixml_node,
lo_node_child TYPE REF TO if_ixml_node,
lo_clone TYPE REF TO if_ixml_node,
lo_children TYPE REF TO if_ixml_node_list,
lo_element TYPE REF TO if_ixml_element,
lo_attribute TYPE REF TO if_ixml_attribute,
lo_filter TYPE REF TO if_ixml_node_filter,
lo_iter TYPE REF TO if_ixml_node_iterator,
lo_doc TYPE REF TO if_ixml_document.
* Filter for nodes of segment E1EDK01
lo_filter = mo_document->create_filter_name( name = 'E1EDK01' ).
CALL METHOD mo_document->create_iterator_filtered
EXPORTING
* depth = 0
filter = lo_filter
RECEIVING
rval = lo_iter.
DO.
lo_node = lo_iter->get_next( ).
EXIT.
ENDDO.
* NODE: First (and single) parent node is the entire E1EDK01 segment
lo_children = lo_node->get_children( ).
lo_filter = mo_document->create_filter_name( name = 'BELNR' ).
lo_iter = lo_children->create_iterator_filtered( lo_filter ).
* NOTE: We should have a single child node => BELNR
DO.
lo_node = lo_iter->get_next( ).
EXIT.
ENDDO.
CHECK ( lo_node IS BOUND ).
ld_name = lo_node->get_name( ).
ld_value = lo_node->get_value( ).
LOG-POINT ID zedi
SUBKEY mc_subkey_runtime
FIELDS syst-index ld_name ld_value.
* Add attribute SD_DOC_CATEGORY and EDI_QUALIFIER to element BELNR
lo_element ?= lo_node.
ld_name = 'SD_DOC_CATEGORY'.
ld_value = ld_sd_doc_category.
CALL METHOD lo_element->set_attribute
EXPORTING
name = ld_name
value = ld_value
RECEIVING
rval = ld_rc.
ld_name = 'EDI_QUALIFIER'.
ld_value = ld_edi_qualifier.
CALL METHOD lo_element->set_attribute
EXPORTING
name = ld_name
value = ld_value
RECEIVING
rval = ld_rc.
ld_name = 'BILL_TYPE'.
ld_value = ld_billing_type.
CALL METHOD lo_element->set_attribute
EXPORTING
name = ld_name
value = ld_value
RECEIVING
rval = ld_rc.
ENDMETHOD.
Regards
Uwe -
Retrieving a xml element/node as clob
New at this - so forgive the basic frustration here...
I have successfully loaded an XML file to be stored as Binary XML table in Oracle 11g. The XML file represents and describes data for use on websites, hence there is a vary large node representing the body text of an HTML page.
I have not attempted loading this XML file with an internal DTD or external xsd at this time, trying to keep things simple for now.
The following query results in an error
SELECT extractValue(value(c),'/article/article_body_page_html') article_body_page_html
FROM WEBSITE_CONTENT2 a,
TABLE(XMLSequence(Extract(object_value,'/website_content2'))) b,
TABLE(XMLSequence(Extract(value(b),'/website_content2/articles/article'))) c
WHERE extractValue(value(c),'/article/article_id') = '61041';
ERROR String result too large
I have tried XMLCAST(extractValue(value(c),'/article/article_body_page_html') AS CLOB) to no avail
It would seem I cannot be the first person running into this issue - and not being a PL/SQL or XML guru - I need some specific examples of retrieving a node/element where the data represented is:
1. Variable in length
2. Exists in the xml file as cdata
3. probably well over 4000 characters.
Could someone please help to provide a solution to what seems a very basic issue.
Thanks in advance.From the 11.1 documentation on ExtractValue it has
"For documents based on XML schemas, if Oracle can infer the type of the return value, then a scalar value of the appropriate type is returned. Otherwise, the result is of type VARCHAR2. For documents that are not based on XML schemas, the return type is always VARCHAR2."
You should be able to use (not tested)
extract(value(c),'/article/article_body_page_html/text()').getClobVal()to get around this problem and ensure the extracted data is always treated as a clob by Oracle. -
XML Gateway Mapping of XML Element Attribute
Hi:
If an inbound XML message contains this tag:
<STATUS CODE="100"></STATUS>
is it possible to map the CODE attribute to a database column?
I've been attempting to do this but I'm receiving this error: Element STATUS not complete, expected elements ''.
Thanks.I'll answer my own question here. Found the section in the XML User Guide about mapping HTTP Error Responses (chapter 22 in the v6.1 pdf) and realized that the XML gateway had preconfigured settings to handle various error conditions. Edited the error handling configuration for the specific Handler (rather than the global setting) and checked the box to allow the error to pass through the XML gateway. Redeployed the subpolicy.
-
I use JSTL to read a remote XML but can only print the content of the elements. How do i print the content of the attributes?
<root><person id="1">George</person></root>
For example, to read the Person's name i use:
<x:out select="$xmloutput/ROOT/person"/>
But how do i print the ID value of the element?
Thanks in advance.Already found the answer:
<x:out select="@attribute_name" />
Just add the @ sign
Maybe you are looking for
-
IOs not rendering correctly when two profiles are logged in simultaneously.
First off, we are two people sharing an iMac. When i.e. the other person has logged in his account it all works fine, but when I log in mine, the bottom bar doesn't appear except the icons. Also the Launchpad doesn't render the graphics correctly. Wh
-
HT201485 Send the answers of security questions of my app.ID.
Hello. I have forgotten the answers of security questions of my apple ID. <Email Edited By Host>
-
Dear All I have a form which shows the output for only one line for a give parameter. But when the same query is copied from the form it shows all 36 rows in backend. i think the issue is becuse of property palette. Kindly update it. regards Arifuddi
-
Anyone having trouble moving their mobile me account to icloud? Everytime I try it does not allow me, says the server is too busy... Anyone else experiencing this?
-
What's the difference between MacBook Pro 13" and MacBook Pro 13" retina?
I want to purchase a MacBook 13" but not sure which one to buy Pro or retina What's the differences? And What one should I buy and why?