Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Generate XML file

13 views
Skip to first unread message

Olivier

unread,
Apr 3, 2001, 2:39:44 AM4/3/01
to
Hi all,
 
I'm trying to generate XML file with the packages xmldom but i don't know how to make ?
 
create or replace procedure test_xml is
    n xmldom.DOMNode;
    doc xmldom.DOMDocument;
    e xmldom.DOMElement;
begin
 
   doc := xmldom.newDOMDocument;
   XmlDom.Setversion(doc,'1.0');
   e := xmldom.createElement(doc,'TEST');
   xmldom.writeToFile(doc,'C:\XML\TEST.XML');
end test_xml;
 
The output file :
            <?xml version = '1.0'?>
 
 
Can you help me ?
 
 
thanks
 
Regards
Olivier
 
 
 

Juan David Perez del Aguila

unread,
Apr 5, 2001, 5:15:48 AM4/5/01
to
Hi!

Try this:

create table p (
  xml varchar2(4000) not null);

declare
  p   xmlparser.parser;
  doc xmldom.DOMDocument;
  e   xmldom.DOMElement;
  t   xmldom.DOMText;
  n   xmldom.DOMNode;
  b   varchar2(4000);
begin
  doc := xmldom.newDOMDocument;
  xmldom.setVersion(doc,'1.0');
  e := xmldom.createElement(doc,'tag');
  t := xmldom.crateTextNode(doc,'Text');
  n := xmldom.appendChild(xmldom.makeNode(doc),xmldom.makeNode(e));
  n := xmldom.appendChild(n,xmldom.makeNode(t));
  xmldom.writeToBuffer(doc,b);
  insert into p values (b);
  xmldom.freeDocument(doc);
end;
/

The result should be:

<?xml version = '1.0'?>

<tag>Text</tag>

Bye.

Olivier escribió:

0 new messages