XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
+ XSLT Help and Discussion (7625)
- XQuery Help and Discussion (2017)
-> + Issue with Processing Instruct... (2)
-> + problem converting json to XML... (2)
-> + Problem base64 decoding string... (3)
-> + Problems posting multipart for... (5)
-> + trouble with download of price... (2)
-> + Problem with http-post not bei... (3)
-> + path problem, xps_file:writeAl... (9)
-> + Xquery update support? (2)
-> + problem with Stylus studio try... (5)
-> + adding dtd reference to xml ou... (4)
-> + xquery escaping ambarsand when... (3)
-> + Whitespace problem when return... (5)
-> + Problem with namespace prefix ... (5)
-> - Sending via SFTP returns unexp... (1)
-> + Query and Sftp clent (4)
-> + xquery and try - catch (3)
-> + Query + ddtek:http-post optio... (5)
-> + Example files referenced in do... (3)
-> + Automatic Error Detection and ... (3)
-> + Working with result of ddtek:h... (2)
-- [1-20] [21-40] [41-60] Next
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Posttop
Vijay karthik BSubject: generate XML file from tables in Local machine
Author: Vijay karthik B
Date: 09 May 2005 03:49 AM
Dear all
I've a problem i want to create a XML file from tables in a local machine thru local machine
my code is

table script
CREATE TABLE PVUSR28FEB05
(
PROV_C NUMBER(9),
PROV_C_EXT NUMBER(3),
PROV_PASS VARCHAR2(15 BYTE),
SESSIONID VARCHAR2(100 BYTE)
)
LOGGING
NOCACHE
NOPARALLEL;


CREATE UNIQUE INDEX PK_PVUSR ON PVUSR28FEB05
(PROV_C, PROV_C_EXT)
LOGGING
NOPARALLEL;


ALTER TABLE PVUSR28FEB05 ADD (
CONSTRAINT PK_PVUSR PRIMARY KEY (PROV_C, PROV_C_EXT));


GRANT DELETE, INDEX, INSERT, SELECT, UPDATE ON PVUSR28FEB05 TO PUBLIC;
PROV_C ,
PROV_C_EXT,
PROV_PASS,
SESSIONID

Procedure---
CREATE OR REPLACE PROCEDURE Write_Xml(
p_prov_c IN PVUSR28FEB05.PROV_C%TYPE,
p_prov_c_ext IN PVUSR28FEB05.PROV_C_EXT%TYPE) AS

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_rec(p_prov_c PVUSR28FEB05.PROV_C%TYPE,p_prov_c_ext PVUSR28FEB05.PROV_C_EXT%TYPE) IS
SELECT PROV_C, PROV_C_EXT, PROV_PASS, SESSIONID, ROWNUM
FROM PVUSR28FEB05
WHERE
PROV_C = p_prov_c AND
PROV_C_EXT = p_prov_c_ext;

BEGIN

doc := xmldom.newDOMDocument;
main_node := xmldom.makeNode(doc);
root_elmt := xmldom.createElement(doc, 'PARAMETERS');
root_node := xmldom.appendChild(main_node, xmldom.makeNode(root_elmt));

FOR idx IN get_rec(p_prov_c,p_prov_c_ext) LOOP --Start Loop

item_elmt := xmldom.createElement(doc,'DETAILS');
xmldom.setAttribute(item_elmt, 'num', idx.ROWNUM);
user_node := xmldom.appendChild(root_node, xmldom.makeNode(item_elmt));

-- create user element: PROV_C
item_elmt := xmldom.createElement(doc, 'PROV_C');
item_node := xmldom.appendChild(user_node, xmldom.makeNode(item_elmt));
item_text := xmldom.createTextNode(doc, idx.PROV_C);
item_node := xmldom.appendChild(item_node, xmldom.makeNode(item_text));

-- create user element: PROV_C_EXT
item_elmt := xmldom.createElement(doc, 'PROV_C_EXT');
item_node := xmldom.appendChild(user_node, xmldom.makeNode(item_elmt));
item_text := xmldom.createTextNode(doc, idx.PROV_C_EXT);
item_node := xmldom.appendChild(item_node, xmldom.makeNode(item_text));

-- create user element: PROV_PASS
item_elmt := xmldom.createElement(doc, 'PROV_PASS');
item_node := xmldom.appendChild(user_node, xmldom.makeNode(item_elmt));
item_text := xmldom.createTextNode(doc, idx.PROV_PASS);
item_node := xmldom.appendChild(item_node, xmldom.makeNode(item_text));

-- create user element: SESSIONID
item_elmt := xmldom.createElement(doc, 'SESSIONID');
item_node := xmldom.appendChild(user_node, xmldom.makeNode(item_elmt));
item_text := xmldom.createTextNode(doc, idx.SESSIONID);
item_node := xmldom.appendChild(item_node, xmldom.makeNode(item_text));

END LOOP; --End of Loop

-- xmldom.writeToFile(doc, '/tmp/xml/docSample.xml'); --Path in which file is created
xmldom.writeToFile(doc, 'C:\docSample.xml');
xmldom.freeDocument(doc); --Freeing the resources

-- Exception handling
EXCEPTION

WHEN xmldom.INDEX_SIZE_ERR THEN
RAISE_APPLICATION_ERROR(-20120, 'Index Size error');
WHEN xmldom.DOMSTRING_SIZE_ERR THEN
RAISE_APPLICATION_ERROR(-20120, 'String Size error');
WHEN xmldom.HIERARCHY_REQUEST_ERR THEN
RAISE_APPLICATION_ERROR(-20120, 'Hierarchy request error');
WHEN xmldom.WRONG_DOCUMENT_ERR THEN
RAISE_APPLICATION_ERROR(-20120, 'Wrong doc error');
WHEN xmldom.INVALID_CHARACTER_ERR THEN
RAISE_APPLICATION_ERROR(-20120, 'Invalid Char error');
WHEN xmldom.NO_DATA_ALLOWED_ERR THEN
RAISE_APPLICATION_ERROR(-20120, 'Nod data allowed error');
WHEN xmldom.NO_MODIFICATION_ALLOWED_ERR THEN
RAISE_APPLICATION_ERROR(-20120, 'No mod allowed error');
WHEN xmldom.NOT_FOUND_ERR THEN
RAISE_APPLICATION_ERROR(-20120, 'Not found error');
WHEN xmldom.NOT_SUPPORTED_ERR THEN
RAISE_APPLICATION_ERROR(-20120, 'Not supported error');
WHEN xmldom.INUSE_ATTRIBUTE_ERR THEN
RAISE_APPLICATION_ERROR(-20120, 'In use attr error');
WHEN OTHERS THEN
dbms_output.put_line(SUBSTR(SQLERRM,1,255));

END Write_Xml;
/


Although the line
xmldom.writeToFile(doc, 'C:\docSample.xml');
is generating a file but in server which i don't want any suggestions or answer pls mail me at bvijaykarthik@yahoo.com
Regards
vijay


   
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.