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 IamaSherpa 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 procedure compiles error free, when I run it I get error ora-29280: invalid directory path. It's refering to the xmldom.writeToFile path. Has anyone seen or been able to get around this?

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;
/

Thanks
 
Hi there

Did you get solution to this problem? We've moved some clients from 9i to 10g and now have the same problem, so any help would be appreciated.

Thanks in advance

Steve
 
You should take into account that the directory you're going to write to should be listed in utl_file_dir and accessible for writing by oracle user.

Regards, Dima
 
In the init file for utl_file_dir we use * instead of paths.
And after dropping and re creating the directories and giving rights to the user it started writing the file without having problems.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top