Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xmldom.writeToFile error

Status
Not open for further replies.

llmclaughlin

Programmer
Aug 20, 2004
140
US
This is an oracle 10g database, getting error message that path I'm using to writetofile is invalid.

Any help

Procedure XMLTEST (
P_BOOKIN VARCHAR2)

IS

BEGIN

DECLARE
doc xmldom.DOMDocument;
main_node xmldom.DOMNode;
root_node xmldom.DOMNode;
user_node xmldom.DOMNode;
item_node xmldom.DOMNode;
root_elmt xmldom.DOMElement;
item_elmt xmldom.DOMElement;
item_text xmldom.DOMText;
CURSOR get_users(p_bookin NUMBER) IS
SELECT booking_number
, lastname
, firstname
, rownum
FROM residents
WHERE booking_number = p_bookin;
BEGIN
-- get document
doc := xmldom.newDOMDocument;
-- create root element
main_node := xmldom.makeNode(doc);
root_elmt := xmldom.createElement(
doc
, 'EMPSET'
);
-- xmldom.setAttribute(root_elmt, 'xmlns', '-- xmldom.setAttribute(root_elmt, 'xmlns:xsi', '-- xmldom.setAttribute(root_elmt, 'xsi:schemaLocation', 'root_node := xmldom.appendChild(
main_node
, xmldom.makeNode(root_elmt)
);
FOR get_users_rec IN get_users(10) LOOP
-- create user element with rownum as attribute
item_elmt := xmldom.createElement(
doc
, 'EMP'
);
xmldom.setAttribute(
item_elmt
, 'num'
, get_users_rec.rownum
);
user_node := xmldom.appendChild(
root_node
, xmldom.makeNode(item_elmt)
);
-- create user element: EMP_NO
item_elmt := xmldom.createElement(
doc
, 'BOOK_NO'
);
item_node := xmldom.appendChild(
user_node
, xmldom.makeNode(item_elmt)
);
item_text := xmldom.createTextNode(
doc
, get_users_rec.booking_number
);
item_node := xmldom.appendChild(
item_node
, xmldom.makeNode(item_text)
);
-- create user element: NAME
item_elmt := xmldom.createElement(
doc
, 'LASTNAME'
);
item_node := xmldom.appendChild(
user_node
, xmldom.makeNode(item_elmt)
);
item_text := xmldom.createTextNode(
doc
, get_users_rec.lastname
);
item_node := xmldom.appendChild(
item_node
, xmldom.makeNode(item_text)
);
-- create user element: Fname
item_elmt := xmldom.createElement(
doc
, 'FirstName');
item_node := xmldom.appendChild(
user_node
, xmldom.makeNode(item_elmt)
);
item_text := xmldom.createTextNode(
doc
, get_users_rec.FirstName
);
item_node := xmldom.appendChild(
item_node
, xmldom.makeNode(item_text)
);
END LOOP;
-- write document to file using default character set from database
xmldom.writeToFile(doc, 'c:\csg\ach\resBook.xml');
-- free resources
xmldom.freeDocument(doc);

END;

END XMLTEST;

END;
/
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top