Home » SQL & PL/SQL » SQL & PL/SQL » XML
XML [message #253319] Mon, 23 July 2007 08:31 Go to next message
Brodiaga
Messages: 3
Registered: July 2007
Location: Russia Moscow
Junior Member

How i can add value in XML tag (node)?
I do following:
...
doc := DBMS_XMLDOM.newDOMDocument('<test>asdad</test>');
main_node := DBMS_XMLDOM.makeNode(doc);
elem := DBMS_XMLDOM.createElement(doc, 'ELEM');

nelem := DBMS_XMLDOM.appendChild(main_node,
DBMS_XMLDOM.makeNode(elem));
...

Result:
<test>asdad</test>
<ELEM/>

I need :
<test>asdad</test>
<ELEM>ssss</ELEM>

Please Help!!!!!
Re: XML [message #253364 is a reply to message #253319] Mon, 23 July 2007 10:50 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
And where should the sssss come from?
Re: XML [message #253451 is a reply to message #253319] Tue, 24 July 2007 00:52 Go to previous messageGo to next message
Brodiaga
Messages: 3
Registered: July 2007
Location: Russia Moscow
Junior Member

to Frank

SSSS it is static text!
For example:

declare
v_text varchar2(10) := 'ssss';

...
Re: XML [message #253467 is a reply to message #253451] Tue, 24 July 2007 01:15 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
What I mean is that you never set the contents of your <ELEM> tag to ssss, so it is to be expected that this tag is empty.
Re: XML [message #253491 is a reply to message #253319] Tue, 24 July 2007 02:12 Go to previous message
Brodiaga
Messages: 3
Registered: July 2007
Location: Russia Moscow
Junior Member

I find decision:

DECLARE
l_doc DBMS_XMLDOM.domdocument;
l_root DBMS_XMLDOM.domelement;
l_node DBMS_XMLDOM.domnode;
l_node2 DBMS_XMLDOM.domnode;
l_text DBMS_XMLDOM.DOMTEXT;
l_buffer VARCHAR2 (1200);
BEGIN
l_doc := DBMS_XMLDOM.newdomdocument;
l_root := DBMS_XMLDOM.createelement (l_doc, 'ROOT');
l_node := DBMS_XMLDOM.makenode (l_root);
l_text := DBMS_XMLDOM.createTextNode(l_doc,'Hello World');
l_node2 := DBMS_XMLDOM.appendChild(l_node, dbms_xmldom.makeNode(l_text));
DBMS_XMLDOM.writetobuffer (l_node, l_buffer);
DBMS_OUTPUT.put_line (l_buffer);
END;

thanks..
Previous Topic: Inline Cursors
Next Topic: How to select and insert and use the value to select again
Goto Forum:
  


Current Time: Fri Dec 02 23:22:12 CST 2016

Total time taken to generate the page: 0.08993 seconds