llmclaughlin
Programmer
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
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