Generating an xml document from SQLplus
Dear list,
We have over 240 database tables in our tablespace, which we would like to very quickly export to an xml file.
Is there any solution ?
regards
Ben
Are the xml documents stored in a XMLType column?
XMLType tables may be retrieved as XML.
http://www.oracle.com/technology/sample_code/tech/java/codesnippet/xmldb/transformxml/TransformXML.html
For tables with non-XMLType columns retrieve the document with XSU utility.
https://cwisdb.cc.kuleuven.ac.be/ora10doc/appdev.101/b10794/adx08xsu.htm#i1014723
Similar Messages
-
Error while generating an XML Document from XML Schema with JAXB
Hi,
I am following this OTN tutorial to generate the XML document from Java classes got from the XSD document.
http://www.oracle.com/technology/pub/notes/technote_jaxb.html
I am able to generate all the Java classes but getting error on compiling the XMLConstructor.java class which is use for generating the XML document :
I am using JDK 1.5 and
Oracle 10g XML Developer's Kit (XDK) Production for Java. xdk_nt_10_1_0_2_0_production
(though these are warnings I am not able to run it.)
Error
C:\Prototype\classes\jaxbderived\catalog>javac -Xlint XMLConstructor.java
warning: [path] bad path element "%CLASSPATH%": no such file or directory
XMLConstructor.java:42: warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.List
journalList.add(journal);
^
XMLConstructor.java:46: warning: [unchecked] unchecked call to add(E) as a membe
r of the raw type java.util.List
articleList.add(article);
Thanks
Sanjeev ([email protected])Use JDK 1.4.
-
Is it possible in java 5 to generate a XML document from object?
Hi all ,
Is it possible in java 5 to generate a XML document from object?if yes, how do I implement this?
~Regards: /\ P:^P would look better. ;)
0 0
>
U -
Generating an XML Document from an internal table in ABAP
Good day to all of you;
With ABAP, in the R/3 system, I'm trying to figure out a way to accomplish the following:
1) SELECT a set of Purchase Order data into an internal table.
2) Generate an XML document, containing the above data, using a specific schema.
I've been playing around with function module SAP_CONVERT_TO_XML_FORMAT which has the following interface:
CALL FUNCTION 'SAP_CONVERT_TO_XML_FORMAT'
EXPORTING
I_FIELD_SEPERATOR = ''
I_LINE_HEADER = ''
I_FILENAME = v_fname
I_APPL_KEEP = ''
I_XML_DOC_NAME = v_docname
IMPORTING
PE_BIN_FILESIZE = v_byte
TABLES
I_TAB_SAP_DATA = i_SapData
CHANGING
I_TAB_CONVERTED_DATA = i_XMLData
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2.
I'm uncertain as to whether or not the Export parameter, I_XML_DOC_NAME refers to some schema or definition and therefore have been excluding it. In doing so, the generated XML document seems to use the field name/type information from my itab for the tags.
If this function module requires an XML Document Name, how do I create one and where do I store it in R/3? If this is not the recommended solution, is anyone familiar with a way to load an XML schema, retrieve some data then have SAP generate an XML document using the schema?
Many thanks for any help available.
THai Phillips
Try with the following Code
This program exports an internal table to an XML file.
Report ZPRUEBA_MML_13 *
Export an internal table to XML document *
NO BORRAR ESTE CODIGO *
REPORT ZPRUEBA_MML_13.
PANTALLA SELECCION *
PARAMETERS: GK_RUTA TYPE RLGRAP-FILENAME.
PANTALLA SELECCION *
TYPE TURNOS *
TYPES: BEGIN OF TURNOS,
LU LIKE T552A-TPR01,
MA LIKE T552A-TPR01,
MI LIKE T552A-TPR01,
JU LIKE T552A-TPR01,
VI LIKE T552A-TPR01,
SA LIKE T552A-TPR01,
DO LIKE T552A-TPR01,
END OF TURNOS.
TYPE TURNOS *
TYPE SOCIO *
TYPES: BEGIN OF SOCIO,
NUMERO LIKE PERNR-PERNR,
REPOSICION LIKE PA0050-ZAUVE,
NOMBRE LIKE PA0002-VORNA,
TURNOS TYPE TURNOS,
END OF SOCIO.
TYPE SOCIO *
ESTRUCTURA ACCESOS *
DATA: BEGIN OF ACCESOS OCCURS 0,
SOCIO TYPE SOCIO,
END OF ACCESOS.
ESTRUCTURA ACCESOS *
START OF SELECTION *
START-OF-SELECTION.
PERFORM LLENA_ACCESOS.
PERFORM DESCARGA_XML.
END-OF-SELECTION.
END OF SELECTION *
FORM LLENA_ACCESOS *
FORM LLENA_ACCESOS.
REFRESH ACCESOS.
CLEAR ACCESOS.
MOVE: '45050' TO ACCESOS-SOCIO-NUMERO,
'MOISES MORENO' TO ACCESOS-SOCIO-NOMBRE,
'0' TO ACCESOS-SOCIO-REPOSICION,
'T1' TO ACCESOS-SOCIO-TURNOS-LU,
'T2' TO ACCESOS-SOCIO-TURNOS-MA,
'T3' TO ACCESOS-SOCIO-TURNOS-MI,
'T4' TO ACCESOS-SOCIO-TURNOS-JU,
'T5' TO ACCESOS-SOCIO-TURNOS-VI,
'T6' TO ACCESOS-SOCIO-TURNOS-SA,
'T7' TO ACCESOS-SOCIO-TURNOS-DO.
APPEND ACCESOS.
CLEAR ACCESOS.
MOVE: '45051' TO ACCESOS-SOCIO-NUMERO,
'RUTH PEÑA' TO ACCESOS-SOCIO-NOMBRE,
'0' TO ACCESOS-SOCIO-REPOSICION,
'T1' TO ACCESOS-SOCIO-TURNOS-LU,
'T2' TO ACCESOS-SOCIO-TURNOS-MA,
'T3' TO ACCESOS-SOCIO-TURNOS-MI,
'T4' TO ACCESOS-SOCIO-TURNOS-JU,
'T5' TO ACCESOS-SOCIO-TURNOS-VI,
'T6' TO ACCESOS-SOCIO-TURNOS-SA,
'T7' TO ACCESOS-SOCIO-TURNOS-DO.
APPEND ACCESOS.
ENDFORM.
FORM LLENA_ACCESOS *
FORM DESCARGA_XML *
FORM DESCARGA_XML.
DATA: L_DOM TYPE REF TO IF_IXML_ELEMENT,
M_DOCUMENT TYPE REF TO IF_IXML_DOCUMENT,
G_IXML TYPE REF TO IF_IXML,
W_STRING TYPE XSTRING,
W_SIZE TYPE I,
W_RESULT TYPE I,
W_LINE TYPE STRING,
IT_XML TYPE DCXMLLINES,
S_XML LIKE LINE OF IT_XML,
W_RC LIKE SY-SUBRC.
DATA: XML TYPE DCXMLLINES.
DATA: RC TYPE SY-SUBRC,
BEGIN OF XML_TAB OCCURS 0,
D LIKE LINE OF XML,
END OF XML_TAB.
CLASS CL_IXML DEFINITION LOAD.
G_IXML = CL_IXML=>CREATE( ).
CHECK NOT G_IXML IS INITIAL.
M_DOCUMENT = G_IXML->CREATE_DOCUMENT( ).
CHECK NOT M_DOCUMENT IS INITIAL.
WRITE: / 'Converting DATA TO DOM 1:'.
CALL FUNCTION 'SDIXML_DATA_TO_DOM'
EXPORTING
NAME = 'ACCESOS'
DATAOBJECT = ACCESOS[]
IMPORTING
DATA_AS_DOM = L_DOM
CHANGING
DOCUMENT = M_DOCUMENT
EXCEPTIONS
ILLEGAL_NAME = 1
OTHERS = 2.
IF SY-SUBRC = 0.
WRITE 'Ok'.
ELSE.
WRITE: 'Err =',
SY-SUBRC.
ENDIF.
CHECK NOT L_DOM IS INITIAL.
W_RC = M_DOCUMENT->APPEND_CHILD( NEW_CHILD = L_DOM ).
IF W_RC IS INITIAL.
WRITE 'Ok'.
ELSE.
WRITE: 'Err =',
W_RC.
ENDIF.
CALL FUNCTION 'SDIXML_DOM_TO_XML'
EXPORTING
DOCUMENT = M_DOCUMENT
IMPORTING
XML_AS_STRING = W_STRING
SIZE = W_SIZE
TABLES
XML_AS_TABLE = IT_XML
EXCEPTIONS
NO_DOCUMENT = 1
OTHERS = 2.
IF SY-SUBRC = 0.
WRITE 'Ok'.
ELSE.
WRITE: 'Err =',
SY-SUBRC.
ENDIF.
LOOP AT IT_XML INTO XML_TAB-D.
APPEND XML_TAB.
ENDLOOP.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = W_SIZE
FILENAME = GK_RUTA
FILETYPE = 'BIN'
TABLES
DATA_TAB = XML_TAB
EXCEPTIONS
OTHERS = 10.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM.
FORM DESCARGA_XML *
Thanks & regards
Sreenivasulu P -
How to generate an XML Document from XQuery
The following query returns me the required XML output. However, I need to generate an XML Document out of it. How do I go about generating an XML Doc?.
SELECT XMLQuery('<Data>
{for $tert in ora:view("DATA"),
$tert_audit in ora:view("DATA_AUDIT")
let $tert_cmd_id := $tert/ROW/ID/text(),
$tert_spouse_name := $tert/ROW/SPOUSE_NAME/text(),
$tert_directions := $tert/ROW/DIRECTIONS/text(),
$tert_soil_zone := $tert/ROW/SOIL_ZONE/text(),
$tert_audit_cmd_id := $tert_audit/ROW/ID/text(),
$tert_audit_trans_date := $tert_audit/ROW/TRANSACTION_DATE/text()
where $tert_cmd_id = $tert_audit_cmd_id and
$tert_audit_trans_date >= xs:date(V_Last_Successful_Date)
order by $tert_cmd_id
return
<op>
<op_type>I</op_type>
<ent_id>{$tert_cmd_id}</ent_id>
<source>S</source>
<fg>
<val_flds>
<fld>
<id>spouse_name</id>
<val>{$tert_spouse_name}</val>
</fld>
<fld>
<id>directions</id>
<val>{$tert_directions}</val>
</fld>
<fld>
<id>soil_zone</id>
<val>{$tert_soil_zone}</val>
</fld>
</val_flds>
</fg>
</op>}</Data>' RETURNING CONTENT)
INTO V_Other_Insert
FROM dual;Hi Geoff,
I would like to generate an XML file which contains data as shown below:
<Insert>
<result>
<type>A</type>
<id>1</id>
<date>11/11/2006</date>
<source>Web</source>
</result>
</Insert>
I'm using the below given query for this purpose:
SELECT XMLQuery('<Insert>
{for $c in ora:view("TableA")
let $id := $c/ROW/ID/text(),
$code := $c/ROW/CODE/text(),
$type := $c/ROW/TYPE/text(),
$date := $c/ROW/DATE/text()
return
<result>
<type>{$type }</type>
<id>{$id}</id>
<date>{$date}</date>
<source>S</source>
</result> }</Insert>' RETURNING CONTENT)
INTO V_Insert
FROM dual;
V_Insert stores the required result.
How do I save this result to a XML Document?
Please help. -
How to use java to create an XML document from an SQL database?
Hi,
I'm a complete novice at XML and have only recently started programming in Java.
I'm currently trying to develop a package in Java 1.1.8 which requires a set of very specifically formatted XML documents. These documents would need to be updated regularly by people with no knowledge of Java and I would like to make it as simple as possible.
Since the data will already be in an SQL database, I thought it might be possible to generate the XML documents from the data using a small Java application, but I'm not too sure how to go about this or if this is even possible! Any help or pointers in the right direction would be very much appreciated.
LouiseDo you have the option of upgrading to a newer version of the JDK?
JAXB does what you are wanting very easily. Also there are tools if you don't want to write your own. JAXB is available as early release on Sun's site as is the newest JDK. Otherwise, you have to design a factory and interface that will do this for you (which is what JAXB basically is in a very simplified view). -
Generating Nested XML Documents
Hi,
We want to generate nested XML documents from sql queries using pl/sql.
If the output of the query is
EMPNO NAME MGRNO
1 Super Admin 0
2 Mgr1 1
4 SubMgr1_1 2
5 SubMgr2_1 2
3 Mgr2 1
6 SubMgr1_2 3
then XML generated should be in the format
Super Admin
Mgr1
SubMgr1_1
SubMgr2_1
Mgr2
SubMgr1_2
Your early response is appreciated.
Thanks.No, the id is not unique, it is part of the data. Also, I don't need to update the XML document.
I store the data part (id, status, nodenum) in the "resp" table with a primary key as a combination of id and some other info. The table "nodes" will have a foreign key and multiple occurrences of node. Same with table "restricts" with multiple restrict.
Do I need to create a DOM tree then store each part of the XML into appropriate tables? And how do I do that? (which APIs, etc.)
Thanks,
Thuvan -
Urgetnt:Generate XML Document from Oracle Tables.
Environment is :9i Release 2
Requirement : Generate XML document from the data which is vailable in Oracle tables at client location.
Could some body help me on how to get ahead on this.
Thanks in advance,
Kumar.Implimentation in PowerBuilder7(Source is experimental.. need optimization):
kml_store = create datastore
selectblob kml into :kml_result from (select get_kml(:querry_type,:tmp_querry_value,1) as kml from dual) using sqlca;
if sqlca.sqlcode=100 then
MessageBox("INFO","No data found");
return false;
end if
if sqlca.sqlcode = -1 then
MessageBox("INFO","Error in generating KMl file");
return false
end if
li_FileNum = FileOpen("test.kml",StreamMode!, Write!, LockWrite!, Replace!);
b_len=Len(kml_result)
b_len=64244;
/*inserting in file :)*/
DO WHILE b_pos<=b_len
s_pipe=String(BlobMid(kml_result,b_pos,i_str_len))
ret = FileWrite(li_FileNum,s_pipe);
s_pipe="";
b_pos=b_pos+i_str_len;
LOOP
FileClose(li_FileNum);
Message was edited by:
user601564 -
Generate an XML file from a DOM tree
Hi,
I'm trying to generate an XML file from a DOM tree that I obtained from another XML file with the Xerces library. I used the following operation :
public static void writeXmlFile(Document doc, String filename) {
try {
Source source = new DOMSource(doc);
File file = new File(filename);
Result result = new StreamResult(file);
Transformer xformer = TransformerFactory.newInstance().newTransformer();
xformer.transform(source, result);
} catch (TransformerConfigurationException e) {
System.err.println(e);
System.exit(1);
} catch (TransformerException e) {
System.err.println(e);
System.exit(1);
But I have this Windows/Linux problem. When I execute this on Windows, everything is correct. But if I try on Linux (every distribution does the same thing), I obtain an XML file where everything is written on just ONE LINE : there is neither identation nor carriage return at the end of a line ... And that is pretty annoying 'cause I need to SEE what I generate ...
Thanks for your answer,
Blueberryfin.Actually I would think that no indents and no new-lines would be more correct, but maybe it's an option for parsers to do it either way if you don't specify it. If you want to specify it, look at this post from last month:
http://forum.java.sun.com/thread.jsp?forum=34&thread=383400 -
Creating an XML document from a DTD in Java
Hi All,
I need help on the following requirement very badly. Pls help me.
I have a requirement to implement with java and XML. I am quit new to XML.Can any of you pls help me.
I have a DTD file. I need to generate XML document from it using java code. I have to use DTD as a template to generate my XML document.
After going through WEB sites, I understtod that, we have to user Java API JAXB for my requirement. But I could not find JAXB.jar anywhere.
I need to know the following inforamtion ....
1. Is my understanding of using JAXB for my requirement is correct?
2. Where can I get JAXB.jar?
3. What are the steps to create XML document from a DTD in Java?
If can give me a sample code for this would help me a lot.
Pls pls reply me. Your help is greatly appreciated.
Thanks in Advance.
Regards,
Gayathri.hi Gayathri,
iam currently working in the same field.
firs download jaxb from this link:
http://java.sun.com/xml/downloads/jaxb.html
first u need to marshall it.
cheers
shashi -
XML Document from XML Schema Bug
When an XML document is generated from an XML Schema the XML document does not have all the elements specified in the XML Schema. The XML document only has the root element.
1. Register an XML Schema.
2. Create an XML document with File>New>General>XML>XML Document from XML Schema. The "Generate only Required Elements" is unchecked.
3. The XML document has only the root element.
In JDeveloper 10.1.3 all the elements in the XML Schema get generated.Also, the component palette for the XML document generated from the XML Schema does not list all the elements in the XML Schema, only the root element is listed. Even if elements are specified as required in the XML Schema with minOccurs="1" and the "Generate only Required Elements" checkbox is selected only the root element gets generated.
-
Using "XML Document from XML Schema" in JDeveloper
Hi Experts,
I have a requirement to generate XML Document from XML Schema.
For this I have used "XML Document from XML Schema" feature in JDeveloper. It is found in File->New->General->XML Document form XML Schema.
I have registered a schema with jdev and got an XML document output for that successfully.
Now, I want to implement this feature in my code for generating XML documents when XSD files are provided.
Can any one please provide me with pointers to do that? I am sure there should be some libraries which can implement this feature.
Thanks,
DilbaghCreate an XML document from a Schema with the Oracle SchemaClassGenerator.
import oracle.xml.classgen.SchemaClassGenerator;
XMLSchema schema=new XMLSchema();
XSDBuilder builder = new XSDBuilder();
URL url = new URL(schemaUrl);
schema = (XMLSchema)builder.build(url);
SchemaClassGenerator generator = new SchemaClassGenerator();
Generate the Java classes from the example XML Schema.
generator.generate(schema);With the java classes construct an XML document. -
Create single XML document from multiple queries
hi all!
being a new programmer in XML world,my question might sound a bit stupid but your answers would mean a world to me. i have to generate a single XML document from my database by querying more than one table. for example i have 3 tables i.e HR_EMP_NAME, HR_PRODUCTS_DETAIL, HR_PAYROLL_SUMMARY. all three tables have completely different columns except one ID column which is a foreign kay from HR_MASTER_LIST. i want to get any insert operation on these tables as a single document. so far as i have studied, one option is to generate XMLDoc using XSU and then add child nodes using JAXP but i am ot geting the logic right.
please do reply.
thanks a lot
usmanThis is an SQL/XML based answer so how much it helps you is hard to say, but it would be one option. You can have the SQL statement build the XML for you as shown by this simple example.
SELECT XMLElement("root",
XMLForest(emp.dummy AS "emp_name",
prod.dummy AS "prod_lvl",
pay.dummy AS "pay_scale"))
FROM dual emp,
dual prod,
dual pay
WHERE emp.dummy = prod.dummy
AND emp.dummy = pay.dummy;which produces (formatted for human readability)
<root>
<emp_name>X</emp_name>
<prod_lvl>X</prod_lvl>
<pay_scale>X</pay_scale>
</root>Whether that works with what you are trying to do via Java you will have to decide. -
Best way to generate the XML files from a DTD file
Hey,
I am writing an application that needs to convert a complicated data structure into an xml file. I have design a DTD file that describes the data structure.
My question is what is the best, most efficient way to covert the data structures (objects) into the XML files with a DTD file.
Thank you very much.
CandyConvert the DTd to an XML Schema. Generate java classes from Schema with Jaxb. Create an XML document from the java classes.
-
How can I access xml document from javascript whithin a JSP page
how can I access xml document from javascript whithin a JSP page?
I have a JSP that receives an XML document from a JavaBean, so I can access it within the entire JSP, but I need to access it from the javascript inside the JSP... and I have no idea how i can do this.
Thanks in advance!The solution would only work on MS IE browsers, as other browsers do not support an XML DOM.
It can be done, but you would be stuck with using the Microsoft broswer. If that is acceptable, I have some example code, and a book recommendation.
Maybe you are looking for
-
My external drive is shared automatically on second accout...
Hi, I dont want my external drive (formated partially to FAT32 and journaled) to be seen on second account - my wifes - (no administrator account for her) but it is at the moment. any suggestions? thanks in advance M
-
How to merge two pictures side by side
How do you merge two pictures side by side?
-
QE71 - automatic valuation is not happening
Hi, We have created a quality plan with free inspection points, Sample size is given as 1 and we would like to record results for 12 times for this sample. We use QE71 for recording results but automatic valuation is not happening. So, we are navigat
-
10.6.5 update went well except....
now my second monitor is darker? I tried several setting and re calibrated, but it is just darker than it was before and i cannot get it back to what it was??? I think i read the issue from someone else, but that was hours ago and probably 100 clicks
-
Running AppleWorks on new Mac Mini
Hi. I recently bought a new Mac Mini, only to learn that AppleWorks didn't ship with it because it has been discontinued. So, I was wondering if there's any way to get AppleWorks to run on Leopard. If there is, how would I go about obtaining a copy o