Generating XML File with Table data...
Hi All,
Bear with me, with my Oracle XML knowledge,,,
we have Oracle 8i ( Relaease 3) as our database, and managegement want to have XML type of Text file, with respect to data in the Customer Table. Expected XML tags would be the Column Names of the Table.
Table has three columns,, Name, Address, Telephone.
So desired XML file looks like below:
<Name>John Hunter</Name><Address> City Road, London</Address><Telephone>1223223</Telephone>
If I deceided to do this task using PL/SQL, how could I start it,,,, All comments are welcome, this is the first time that I am going to generate this type of file ,,,
Hi Chandana,
You can check out the DBMS_XMLQUERY package for this purpose. It provides XMLType functionality in Oracle 8i. You can access the documentation for the same at:
http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/d_xmlque.htm#ARPLS066
If you happen to have access to Oracle 9i, then you can use XMLType Views provided with XML DB for your requirement.
Thanks
Shefali
Similar Messages
-
How to generate XML file from a table without using UTL_FILE that too in local machine...
You downloaded the wrong XML Parser!
XSQL requires Java Parser. Well, there's a copy included with the XSQL package so you actually don't need to do another download.
You really don't need XSQL if you just want a XML file from DB, you just needed a XML SQL Utility. Download that and run the samples. -
Generate XML from Oracle Table Data
Hi All,
I am new to this network. I am also new to oracle XML package. I want a help for the below query.
CREATE TABLE EMP(ID NUMBER PRIMARY KEY, NAME VARCHAR2(10), PHONE NUMBER);
INSERT INTO EMP(ID,NAME,PHONE) VALUES (11,'Joy',1234);
INSERT INTO EMP(ID,NAME,PHONE) VALUES (22,'Mike',5678);
INSERT INTO EMP(ID,NAME,PHONE) VALUES (33,'Jason',NULL);
COMMIT;
I want to export the EMP table data in a XML file with the below format.
Required Output:
<?xml version="1.0" encoding="UTF-8"?><STATICDATA><EMP><ID>11</ID><NAME>Joy</NAME></EMP></STATICDATA>
<?xml version="1.0" encoding="UTF-8"?><STATICDATA><EMP><ID>22</ID><NAME>Mike</NAME></EMP></STATICDATA>
<?xml version="1.0" encoding="UTF-8"?><STATICDATA><EMP><ID>33</ID><NAME>Jason</NAME></EMP></STATICDATA>
I have used some XML functions and have written the below query.
select XMLROOT(XMLELEMENT(staticdata,XMLELEMENT(EMP,XMLELEMENT(ID,ID),XMLELEMENT(NAME,NAME))), version '1.0" encoding="UTF-8') xml FROM EMP;
output of my query:
<?xml version="1.0" encoding="UTF-8"?>
<STATICDATA>
<EMP>
<ID>11</ID>
<NAME>Joy</NAME>
</EMP>
</STATICDATA>
<?xml version="1.0" encoding="UTF-8"?>
<STATICDATA>
<EMP>
<ID>22</ID>
<NAME>Mike</NAME>
</EMP>
</STATICDATA>
<?xml version="1.0" encoding="UTF-8"?>
<STATICDATA>
<EMP>
<ID>33</ID>
<NAME>Jason</NAME>
</EMP>
</STATICDATA>
But i want the out as the required output above. every record in a single line. can any one help me in achieving the required output. also can i export all the columns of the table by some thing like select * from the table in XML file ?
Thanks,
Sartajuser13683418 wrote:
Hi All,
I am new to this network. I am also new to oracle XML package. I want a help for the below query.
CREATE TABLE EMP(ID NUMBER PRIMARY KEY, NAME VARCHAR2(10), PHONE NUMBER);
INSERT INTO EMP(ID,NAME,PHONE) VALUES (11,'Joy',1234);
INSERT INTO EMP(ID,NAME,PHONE) VALUES (22,'Mike',5678);
INSERT INTO EMP(ID,NAME,PHONE) VALUES (33,'Jason',NULL);
COMMIT;
I want to export the EMP table data in a XML file with the below format.
Required Output:
<?xml version="1.0" encoding="UTF-8"?><STATICDATA><EMP><ID>11</ID><NAME>Joy</NAME></EMP></STATICDATA>
<?xml version="1.0" encoding="UTF-8"?><STATICDATA><EMP><ID>22</ID><NAME>Mike</NAME></EMP></STATICDATA>
<?xml version="1.0" encoding="UTF-8"?><STATICDATA><EMP><ID>33</ID><NAME>Jason</NAME></EMP></STATICDATA>
I have used some XML functions and have written the below query.
select XMLROOT(XMLELEMENT(staticdata,XMLELEMENT(EMP,XMLELEMENT(ID,ID),XMLELEMENT(NAME,NAME))), version '1.0" encoding="UTF-8') xml FROM EMP;
output of my query:
<?xml version="1.0" encoding="UTF-8"?>
<STATICDATA>
<EMP>
<ID>11</ID>
<NAME>Joy</NAME>
</EMP>
</STATICDATA>
<?xml version="1.0" encoding="UTF-8"?>
<STATICDATA>
<EMP>
<ID>22</ID>
<NAME>Mike</NAME>
</EMP>
</STATICDATA>
<?xml version="1.0" encoding="UTF-8"?>
<STATICDATA>
<EMP>
<ID>33</ID>
<NAME>Jason</NAME>
</EMP>
</STATICDATA>
But i want the out as the required output above. every record in a single line.Why?
Some things output XML all as one stream, some things naturally display it structured. It doesn't matter as the XML is still the same because by it's very nature it is a structured data definition. Anything that reads XML will be able to read it whether it's on one line (streamed) or structured.
also can i export all the columns of the table by some thing like select * from the table in XML file ?A couple of ways of exporting XML to a file...
-- DBMS_XSLPROCESSOR.clob2file
-- outputs a clob to a file
DECLARE
ctx DBMS_XMLGEN.ctxtype;
BEGIN
ctx := DBMS_XMLGEN.newcontext ('select * from emp');
DBMS_XSLPROCESSOR.clob2file (DBMS_XMLGEN.getxml (ctx), 'TEMP', 'emp.xml');
DBMS_XMLGEN.closecontext (ctx);
END;
PL/SQL procedure successfully completed.or
..snip..
v_xml XMLTYPE;
v_doc XMLDOM.DOMDocument;
v_dir VARCHAR2(2000);
v_file VARCHAR2(2000);
BEGIN
v_xml := ... populate with XML ...;
v_dir := 'TEST_DIR'; -- directory object name (in UPPER CASE)
v_file := 'myfile.xml';
v_doc := DBMS_XMLDOM.NEWDOMDOCUMENT(v_xml);
DBMS_XMLDOM.WRITETOFILE(v_doc, v_dir||'\'||v_file, 'UTF-8');
DBMS_XMLDOM.FREEDOCUMENT(v_doc);
..snip.. -
i used form2xml in oracle 10 g suit to convert forms 5 .fmb to .xml . using the command:
frmf2xml.bat OVERWRITE=YES myform.fmb
The forms contains arabic character set, but the xml file is generated with character "????????? " , and the xml file is unusable
what can i do to keep arabic characters in the generated xml files.
Edit:
I run form2xml on windows xp SP3 with arabic support (codepage =1256)
The xml file is generated as UTF-8I resolved the problem.
step1: search in the registry for every NLS_Lang key and modify its value to codepage 1256 using regedit
step2: in control panel-Region and Language , I modified language to be Arabic
Now every thing is good -
Validating generated XML file with DTD
Hello all,
my requirement is to test the XML file with its DTD.
we are creating an XML file, before writing it on the application server , we need to test it with its DTD.
i found one method set_validating in the interface if_ixml_parser , for validating XML file, but not getting an idea how to use it, like how to link the DTD to XML etc.
if i try to use the above method am getting the following error:
Unable to retrieve the external entity 'd:\dtdfile.dtd'.
where 'd:\dtdfile.dtd' is the path of the DTD file included in the Doctype of the XML file.
Please help me to solve this.
Thx in advance.Hello,
Did you find your answer ?
I know how to validate an XML file an internal DTD, but not an external one... If you know, can you pelase advice ?
If you didn't found yet, you need to use method get_reason() to get the description of the error.
best regards,
Gilles. -
Generate XML file with Elements and attributes from Oracle table
Hi,
I have the following table structure.
CREATE TABLE COIL
COIL_ID NUMBER(10),
COIL_NUMBER VARCHAR2(40),
COIL_PO_OPERATING_UNIT VARCHAR2(20),
COIL_PO_NUMBER VARCHAR2(40),
MILL_NUMBER VARCHAR2(2),
MILL_COIL_STATUS VARCHAR2(15),
ITEM_NUMBER VARCHAR2(40),
COIL_WEIGHT NUMBER(38),
WEIGHT_UOM VARCHAR2(10),
DOCUMENT_NUMBER VARCHAR2(40),
DOCUMENT_DATE DATE,
DOCUMENT_STATUS VARCHAR2(15),
DOCUMENT_TYPE VARCHAR2(20),
DOCUMENT_SOURCE VARCHAR2(20),
TEST_ID NUMBER(38),
VALUE NUMBER,
TEST_UOM VARCHAR2(20),
TEST_STATUS VARCHAR2(70),
TESTER_LOGIN VARCHAR2(20),
EQUIPMENT_CODE VARCHAR2(50),
DOC_STS_MSG VARCHAR2(600)
For each COILID record, there could be multiple records baased on TEST_ID/VALUE/TEST_UOM etc.
And I would like to prepare xml file in the following format by selecting data from COIL?
<?xml version="1.0"?>
-<Coil xsi:noNamespaceSchemaLocation="www.tempel.com/COIL.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xdb="http://xmlns.oracle.com/xdb">
<CoilId>1419532</CoilId>
<CoilNo>D2221050010A0</CoilNo>
<CoilPOOperatingUnit>Changzhou</CoilPOOperatingUnit>
<CoilPONo>4619</CoilPONo>
<MillNo>86</MillNo>
<MillCoilStatus>Test</MillCoilStatus>
<ItemNo>050FP800 C5</ItemNo>
<Weight>7076</Weight>
<UOM>KILOGRAM</UOM>
<DocumentNo>0</DocumentNo>
<DocumentDate>2013-01-11</DocumentDate>
<DocumentStatus>NonProcessed</DocumentStatus>
<DocumentType>Tests</DocumentType>
<DocumentSource>CHIGMA1</DocumentSource>
<Tests DocStsMsg="0" EquipmentCode="CHIGMA1" TesterLogin="dpkrueger" Value="0.4992" TestUnit="mm" Status="NonProcessed" TestId="135"/>
<Tests DocStsMsg="0" EquipmentCode="CHIGMA1" TesterLogin="dpkrueger" Value="0.0128" TestUnit="mm" Status="NonProcessed" TestId="124"/>
<Tests DocStsMsg="0" EquipmentCode="CHIGMA1" TesterLogin="dpkrueger" Value="12" TestUnit="mm" Status="NonProcessed" TestId="125"/>
<Tests DocStsMsg="0" EquipmentCode="CHIGMA1" TesterLogin="dpkrueger" Value="0.5095" TestUnit="mm" Status="NonProcessed" TestId="127"/>
<Tests DocStsMsg="0" EquipmentCode="CHIGMA1" TesterLogin="dpkrueger" Value="0.5042" TestUnit="mm" Status="NonProcessed" TestId="128"/>
<Tests DocStsMsg="0" EquipmentCode="CHIGMA1" TesterLogin="dpkrueger" Value="0.5058" TestUnit="mm" Status="NonProcessed" TestId="129"/>
<Tests DocStsMsg="0" EquipmentCode="CHIGMA1" TesterLogin="dpkrueger" Value="0.4967" TestUnit="mm" Status="NonProcessed" TestId="130"/>
<Tests DocStsMsg="0" EquipmentCode="CHIGMA1" TesterLogin="dpkrueger" Value="0.5049" TestUnit="mm" Status="NonProcessed" TestId="131"/>
<Tests DocStsMsg="0" EquipmentCode="CHIGMA1" TesterLogin="dpkrueger" Value="0.4972" TestUnit="mm" Status="NonProcessed" TestId="132"/>
<Tests DocStsMsg="0" EquipmentCode="CHIGMA1" TesterLogin="dpkrueger" Value="0.4960" TestUnit="mm" Status="NonProcessed" TestId="133"/>
<Tests DocStsMsg="0" EquipmentCode="CHIGMA1" TesterLogin="dpkrueger" Value="0.4996" TestUnit="mm" Status="NonProcessed" TestId="134"/>
</Coil>
Can you please guide me how to do it in a single query?
Thanks in advance.Hi Odie,
Thanks for the quick offer.Sure,No problem.I expect the format to be as follows
<Coil xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="www.tempel.com/COIL.xsd">
<CoilId>97239</CoilId>
<CoilNo>777078</CoilNo>
<CoilPOOperatingUnit>TSUSA</CoilPOOperatingUnit>
<CoilPONo>3407</CoilPONo>
<MillNo>31</MillNo>
<MillCoilStatus>Test</MillCoilStatus>
<ItemNo>0140SP150 C5A</ItemNo>
<Weight>17365</Weight>
<UOM>POUNDS</UOM>
<DocumentNo>0</DocumentNo>
<DocumentDate>2008-10-13</DocumentDate>
<DocumentStatus>Processed</DocumentStatus>
<DocumentType>Tests</DocumentType>
<DocumentSource>MILL</DocumentSource>
<Tests EquipmentCode="MILLEDI" TesterLogin="MILLEDI" Value="84" TestUnit="15T" Status="Processed" TestId="65"></Tests>
<Tests EquipmentCode="MILLEDI" TesterLogin="MILLEDI" Value="1.39" TestUnit="W/Lb" Status="Processed" TestId="48"></Tests>
<Tests EquipmentCode="MILLEDI" TesterLogin="MILLEDI" Value="1979" TestUnit="W/Lb" Status="Processed" TestId="49"></Tests>
</Coil>
But instead it came with below format
<Coil xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSch
emaLocation="www.tempel.com/COIL.xsd"><CoilId>97239</CoilId><CoilNo>777078</Co
ilNo><CoilPOOperatingUnit>TSUSA</CoilPOOperatingUnit><CoilPONo>3407</CoilPONo>
<MillNo>31</MillNo><MillCoilStatus>Test</MillCoilStatus><ItemNo>0140SP150 C5A<
/ItemNo><Weight>17365</Weight><UOM>POUNDS</UOM><DocumentNo>0</DocumentNo><Docu
mentDate>2008-10-13</DocumentDate><DocumentStatus>Processed</DocumentStatus><Do
cumentType>Tests</DocumentType><DocumentSource>MILL</DocumentSource><Tests Equ
ipmentCode="MILLEDI" TesterLogin="MILLEDI" Value="84" TestUnit="15T" Status="P
rocessed" TestId="65"></Tests><Tests EquipmentCode="MILLEDI" TesterLogin="MILL
EDI" Value="1.39" TestUnit="W/Lb" St atus="Processed" TestId="48"></Tests><Tes
ts EquipmentCode="MILLEDI" TesterLog in="MILLEDI" Value="1979" TestUnit="W/Lb"
Status="Processed" TestId="49"></Tests></Coil>
The sample insert records are as follows
insert into COIL (coil_id, coil_number, coil_po_operating_unit, coil_po_number, mill_number, mill_coil_status, item_number, coil_weight, weight_uom, document_number, document_date, document_status, document_type, document_source, test_id, value, test_uom, test_status, tester_login, equipment_code, doc_sts_msg)
values (97239, '777078', 'USA', '3407', '31', 'Test', '0140SP150 C5A', 17365, 'POUNDS', '0', to_date('13-10-2008', 'dd-mm-yyyy'), 'Processed', 'Tests', 'MILL', 65, 84, '15T', 'Processed', 'MILLEDI', 'MILLEDI', null);
insert into COIL (coil_id, coil_number, coil_po_operating_unit, coil_po_number, mill_number, mill_coil_status, item_number, coil_weight, weight_uom, document_number, document_date, document_status, document_type, document_source, test_id, value, test_uom, test_status, tester_login, equipment_code, doc_sts_msg)
values (97239, '777078', 'USA', '3407', '31', 'Test', '0140SP150 C5A', 17365, 'POUNDS', '0', to_date('13-10-2008', 'dd-mm-yyyy'), 'Processed', 'Tests', 'MILL', 48, 1.39, 'W/Lb', 'Processed', 'MILLEDI', 'MILLEDI', null);
insert into COIL (coil_id, coil_number, coil_po_operating_unit, coil_po_number, mill_number, mill_coil_status, item_number, coil_weight, weight_uom, document_number, document_date, document_status, document_type, document_source, test_id, value, test_uom, test_status, tester_login, equipment_code, doc_sts_msg)
values (97239, '777078', 'USA', '3407', '31', 'Test', '0140SP150 C5A', 17365, 'POUNDS', '0', to_date('13-10-2008', 'dd-mm-yyyy'), 'Processed', 'Tests', 'MILL', 49, 1979, 'W/Lb', 'Processed', 'MILLEDI', 'MILLEDI', null);
commit;
Thanks in Advance. -
Create XML file from table data
Dear All,
with dataservice 4.0, I want to create an XML file from a table data.
Table have a single column but more record, for example:
0001000488;100;EUR;
0001000489;200;EUR;
0001000450;300;EUR;
My desired XML output:
<Data>
0001000488;100;GBP;
0001000489;200;EUR;
0001000450;300;EUR;
</Data>
I try with a sample query but the sistem write only the last record in XML file:
<Data>
0001000450;300;EUR;
</Data>
Can everyone help me?
Thank in advance.
SimoneHello
That is a very simple (also odd) XML document structure, and as such doesn't require use of the XML target. It can be easily acheived by writing a normal file with a header and footer, which is acheived using a row_generation and a query to generate the hard coded open and close tags.
Michael -
Writing a java program for generating .pdf file with the data of MS-Excel .
Hi all,
My object is write a java program so tht...it'll generate the .pdf file after retriving the data from MS-Excel file.
I used POI HSSF to read the data from MS-Excel and used iText to generate .pdf file:
My Program is:
* Created on Apr 13, 2005
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
package forums;
import java.io.*;
import java.awt.Color;
import com.lowagie.text.*;
import com.lowagie.text.pdf.*;
import com.lowagie.text.Font.*;
import com.lowagie.text.pdf.MultiColumnText;
import com.lowagie.text.Phrase.*;
import net.sf.hibernate.mapping.Array;
import org.apache.poi.hssf.*;
import org.apache.poi.poifs.filesystem.*;
import org.apache.poi.hssf.usermodel.*;
import com.lowagie.text.Phrase.*;
import java.util.Iterator;
* Generates a simple 'Hello World' PDF file.
* @author blowagie
public class pdfgenerator {
* Generates a PDF file with the text 'Hello World'
* @param args no arguments needed here
public static void main(String[] args) {
System.out.println("Hello World");
Rectangle pageSize = new Rectangle(916, 1592);
pageSize.setBackgroundColor(new java.awt.Color(0xFF, 0xFF, 0xDE));
// step 1: creation of a document-object
//Document document = new Document(pageSize);
Document document = new Document(pageSize, 132, 164, 108, 108);
try {
// step 2:
// we create a writer that listens to the document
// and directs a PDF-stream to a file
PdfWriter writer =PdfWriter.getInstance(document,new FileOutputStream("c:\\weeklystatus.pdf"));
writer.setEncryption(PdfWriter.STRENGTH128BITS, "Hello", "World", PdfWriter.AllowCopy | PdfWriter.AllowPrinting);
// step 3: we open the document
document.open();
Paragraph paragraph = new Paragraph("",new Font(Font.TIMES_ROMAN, 13, Font.BOLDITALIC, new Color(0, 0, 255)));
POIFSFileSystem pofilesystem=new POIFSFileSystem(new FileInputStream("D:\\ESM\\plans\\weekly report(31-01..04-02).xls"));
HSSFWorkbook hbook=new HSSFWorkbook(pofilesystem);
HSSFSheet hsheet=hbook.getSheetAt(0);//.createSheet();
Iterator rows = hsheet.rowIterator();
while( rows.hasNext() ) {
Phrase phrase=new Phrase();
HSSFRow row = (HSSFRow) rows.next();
//System.out.println( "Row #" + row.getRowNum());
// Iterate over each cell in the row and print out the cell's content
Iterator cells = row.cellIterator();
while( cells.hasNext() ) {
HSSFCell cell = (HSSFCell) cells.next();
//System.out.println( "Cell #" + cell.getCellNum() );
switch ( cell.getCellType() ) {
case HSSFCell.CELL_TYPE_STRING:
String stringcell=cell.getStringCellValue ()+" ";
writer.setSpaceCharRatio(PdfWriter.NO_SPACE_CHAR_RATIO);
phrase.add(stringcell);
// document.add(new Phrase(string));
System.out.print( cell.getStringCellValue () );
break;
case HSSFCell.CELL_TYPE_FORMULA:
String stringdate=cell.getCellFormula()+" ";
writer.setSpaceCharRatio(PdfWriter.NO_SPACE_CHAR_RATIO);
phrase.add(stringdate);
System.out.print( cell.getCellFormula() );
break;
case HSSFCell.CELL_TYPE_NUMERIC:
String string=String.valueOf(cell.getNumericCellValue())+" ";
writer.setSpaceCharRatio(PdfWriter.NO_SPACE_CHAR_RATIO);
phrase.add(string);
System.out.print( cell.getNumericCellValue() );
break;
default:
//System.out.println( "unsuported sell type" );
break;
document.add(new Paragraph(phrase));
document.add(new Paragraph("\n \n \n"));
// step 4: we add a paragraph to the document
} catch (DocumentException de) {
System.err.println(de.getMessage());
} catch (IOException ioe) {
System.err.println(ioe.getMessage());
// step 5: we close the document
document.close();
My Input from MS-Excel file is:
Planning and Tracking Template for Interns
Name of the Intern N.Kesavulu Reddy
Project Name Enterprise Sales and Marketing
Description Estimated Effort in Hrs Planned/Replanned Actual Actual Effort in Hrs Complexity Priority LOC written new & modified % work completion Status Rework Remarks
S.No Start Date End Date Start Date End Date
1 setup the configuration 31/01/2005 1/2/2005 31/01/2005 1/2/2005
2 Deploying an application through Tapestry, Spring, Hibernate 2/2/2005 2/2/2005 2/2/2005 2/2/2005
3 Gone through Componentization and Cxprice application 3/2/2005 3/2/2005 3/2/2005 3/2/2005
4 Attend the sessions(tapestry,spring, hibernate), QBA 4/2/2005 4/2/2005 4/2/2005 4/2/2005
The o/p I'm gettint in .pdf file is:
Planning and Tracking Template for Interns
N.Kesavulu Reddy Name of the Intern
Enterprise Sales and Marketing Project Name
Remarks Rework Status % work completion LOC written new & modified Priority
Complexity Actual Effort in Hrs Actual Planned/Replanned Estimated Effort in Hrs Description
End Date Start Date End Date Start Date S.No
38354.0 31/01/2005 38354.0 31/01/2005 setup the configuration 1.0
38385.0 38385.0 38385.0 38385.0 Deploying an application through Tapestry, Spring, Hibernate
2.0
38413.0 38413.0 38413.0 38413.0 Gone through Componentization and Cxprice application
3.0
38444.0 38444.0 38444.0 38444.0 Attend the sessions(tapestry,spring, hibernate), QBA 4.0
The issues i'm facing are:
When it is reading a row from MS-Excel it is writing to the .pdf file from last cell to first cell.( 2 cell in 1 place, 1 cell in 2 place like if the row has two cells with data as : Name of the Intern: Kesavulu Reddy then it is writing to the .pdf file as Kesavulu Reddy Name of Intern)
and the second issue is:
It is not recognizing the date format..it is recognizing the date in first row only......
Plz Tell me wht is the solution for this...
Regards
[email protected]Don't double post your question:
http://forum.java.sun.com/thread.jspa?threadID=617605&messageID=3450899#3450899
/Kaj -
How to generate SWF file with dynamic data but no live connection
Hello,
We got a requirement where we have to email out SWF file either in PPT or outlook generated from BOBJ universe. When the file reaches the customer who would be outside our network with no access to our servers or data should be able to view the swf file with data. So the goal is to generate these files automatically and should not prompt for BOBJ login or wouldn't have ability to query the database but need to report data pertaining to the customer.
Any help in this regards is greatly appreciated.
Thanks
ManoharHi Manohar,
You can use QAAWS(query as a web services) and build your queries on universe.
You get an option of hardcoding the user id and password in the data connection for QAAWS which will not asks the users for login credentials.
This will hepl the user to veiw the latest data from the database and the user wont be asked for login too.
Thanks,
Amit. -
How to generate xml file with multiple nodes using sqlserver as database in SSIS..
Hi ,
I have to generate the xml file using multiple nodes by using ssis and database is sqlserver.
Can some one guide me on to perform this task using script task?
sudhaWhy not use T-SQL for generating XML? You can use FOR XML for that
http://visakhm.blogspot.in/2014/05/t-sql-tips-fun-with-for-xml-path.html
http://visakhm.blogspot.in/2013/12/generating-nested-xml-structures-with.html
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
How can i write a XML file with oracle data ?
How can i write a XML file using PL/SQL.
Can i do as follows.
1.Open a file using UTL_FILE.FOPEN(LC_DIR_LOC,'abc.xml','W') ;
2.write all the required tag and value using UTL.put_line
that is enough. Is not, please guide me to write.
gkHaving Oracle 9i.
One more doubt. In the speck, some constand values are there, When i write the same into file, How can i write ?.
1. l_str := ' "E27" '
or
2. l_str := ' E27 '
UTL_FILE.PUT_LINE(L_FILE_POI,l_str,TRUE);
1 case : in XML file : "E27"
In 2 case : E27
When we write a XML file through editors , we have to define the constant within quote . is it?
Which one can i use ? Or any other way is there ..
Thanks and Regards
gopi -
Generating .csv file with the datas from the database
Hi Java experts,
Ihave a current assignment to generate a .CSV file using java getting values from database. The output CSV file may have more than one row and each row should have a end of line delimiter. Any help in giving a template for generating a CSV file accessing from database is greatly appreciated.Ihave a current assignment to generate a .CSV file
using java getting values from database.well, I hope you learn something doing it yourself...
The output
CSV file may have more than one row and each row
should have a end of line delimiter. Any help in
giving a template for generating a CSV file accessing
from database is greatly appreciated.How about looking for a JDBC and a file/print stream tutorial? -
XML generation with SAP data using XML schema - Reg
Hello experts,
My requirement is , SAP( ztable data ) data has to be transferred to third party software folder.Third party using XML so they requires output from SAP in XML format.
For that third party software guys told me that they will give their own XML schema to me.I have to generate XML file with SAP data using their XML schema.
Generating XML file with their Schema should be underlined.
I studied that call transformation statement helps for this.
Even then i don't have clear idea about this topic.
Please brief me about how to use their XML schema to generate XML with my own sap data.
Thanks in advance experts.
Kumarplease try this same program and see it ....
*& Report z_xit_xml_check
REPORT z_xit_xml_check.
TYPE-POOLS: ixml.
TYPES: BEGIN OF t_xml_line,
data(256) TYPE x,
END OF t_xml_line.
DATA: l_ixml TYPE REF TO if_ixml,
l_streamfactory TYPE REF TO if_ixml_stream_factory,
l_parser TYPE REF TO if_ixml_parser,
l_istream TYPE REF TO if_ixml_istream,
l_document TYPE REF TO if_ixml_document,
l_node TYPE REF TO if_ixml_node,
l_xmldata TYPE string.
DATA: l_elem TYPE REF TO if_ixml_element,
l_root_node TYPE REF TO if_ixml_node,
l_next_node TYPE REF TO if_ixml_node,
l_name TYPE string,
l_iterator TYPE REF TO if_ixml_node_iterator.
DATA: l_xml_table TYPE TABLE OF t_xml_line,
l_xml_line TYPE t_xml_line,
l_xml_table_size TYPE i.
DATA: l_filename TYPE string.
PARAMETERS: pa_file TYPE char1024 DEFAULT 'c:temporders_dtd.xml'.
* Validation of XML file: Only DTD included in xml document is supported
PARAMETERS: pa_val TYPE char1 AS CHECKBOX.
START-OF-SELECTION.
* Creating the main iXML factory
l_ixml = cl_ixml=>create( ).
* Creating a stream factory
l_streamfactory = l_ixml->create_stream_factory( ).
PERFORM get_xml_table CHANGING l_xml_table_size l_xml_table.
* wrap the table containing the file into a stream
l_istream = l_streamfactory->create_istream_itable( table = l_xml_table
size = l_xml_table_size ).
* Creating a document
l_document = l_ixml->create_document( ).
* Create a Parser
l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
istream = l_istream
document = l_document ).
* Validate a document
IF pa_val EQ 'X'.
l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
ENDIF.
* Parse the stream
IF l_parser->parse( ) NE 0.
IF l_parser->num_errors( ) NE 0.
DATA: parseerror TYPE REF TO if_ixml_parse_error,
str TYPE string,
i TYPE i,
count TYPE i,
index TYPE i.
count = l_parser->num_errors( ).
WRITE: count, ' parse errors have occured:'.
index = 0.
WHILE index < count.
parseerror = l_parser->get_error( index = index ).
i = parseerror->get_line( ).
WRITE: 'line: ', i.
i = parseerror->get_column( ).
WRITE: 'column: ', i.
str = parseerror->get_reason( ).
WRITE: str.
index = index + 1.
ENDWHILE.
ENDIF.
ENDIF.
* Process the document
IF l_parser->is_dom_generating( ) EQ 'X'.
PERFORM process_dom USING l_document.
ENDIF.
*& Form get_xml_table
FORM get_xml_table CHANGING l_xml_table_size TYPE i
l_xml_table TYPE STANDARD TABLE.
* Local variable declaration
DATA: l_len TYPE i,
l_len2 TYPE i,
l_tab TYPE tsfixml,
l_content TYPE string,
l_str1 TYPE string,
c_conv TYPE REF TO cl_abap_conv_in_ce,
l_itab TYPE TABLE OF string.
l_filename = pa_file.
* upload a file from the client's workstation
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = l_filename
filetype = 'BIN'
IMPORTING
filelength = l_xml_table_size
CHANGING
data_tab = l_xml_table
EXCEPTIONS
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* Writing the XML document to the screen
CLEAR l_str1.
LOOP AT l_xml_table INTO l_xml_line.
c_conv = cl_abap_conv_in_ce=>create( input = l_xml_line-data replacement = space ).
c_conv->read( IMPORTING data = l_content len = l_len ).
CONCATENATE l_str1 l_content INTO l_str1.
ENDLOOP.
l_str1 = l_str1+0(l_xml_table_size).
SPLIT l_str1 AT cl_abap_char_utilities=>cr_lf INTO TABLE l_itab.
WRITE: /.
WRITE: /' XML File'.
WRITE: /.
LOOP AT l_itab INTO l_str1.
REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab IN
l_str1 WITH space.
WRITE: / l_str1.
ENDLOOP.
WRITE: /.
ENDFORM. "get_xml_table
*& Form process_dom
FORM process_dom USING document TYPE REF TO if_ixml_document.
DATA: node TYPE REF TO if_ixml_node,
iterator TYPE REF TO if_ixml_node_iterator,
nodemap TYPE REF TO if_ixml_named_node_map,
attr TYPE REF TO if_ixml_node,
name TYPE string,
prefix TYPE string,
value TYPE string,
indent TYPE i,
count TYPE i,
index TYPE i.
node ?= document.
CHECK NOT node IS INITIAL.
ULINE.
WRITE: /.
WRITE: /' DOM-TREE'.
WRITE: /.
IF node IS INITIAL. EXIT. ENDIF.
* create a node iterator
iterator = node->create_iterator( ).
* get current node
node = iterator->get_next( ).
* loop over all nodes
WHILE NOT node IS INITIAL.
indent = node->get_height( ) * 2.
indent = indent + 20.
CASE node->get_type( ).
WHEN if_ixml_node=>co_node_element.
* element node
name = node->get_name( ).
nodemap = node->get_attributes( ).
WRITE: / 'ELEMENT :'.
WRITE: AT indent name COLOR COL_POSITIVE INVERSE.
IF NOT nodemap IS INITIAL.
* attributes
count = nodemap->get_length( ).
DO count TIMES.
index = sy-index - 1.
attr = nodemap->get_item( index ).
name = attr->get_name( ).
prefix = attr->get_namespace_prefix( ).
value = attr->get_value( ).
WRITE: / 'ATTRIBUTE:'.
WRITE: AT indent name COLOR COL_HEADING INVERSE, '=',
value COLOR COL_TOTAL INVERSE.
ENDDO.
ENDIF.
WHEN if_ixml_node=>co_node_text OR
if_ixml_node=>co_node_cdata_section.
* text node
value = node->get_value( ).
WRITE: / 'VALUE :'.
WRITE: AT indent value COLOR COL_GROUP INVERSE.
ENDCASE.
* advance to next node
node = iterator->get_next( ).
ENDWHILE.
ENDFORM. "process_dom
reward points if it is use fulll ....
Girish -
Generation of Xml file with java output
Hi i m new to xml and java combination. I have a name value pair kind of output returning from java program. I want to generate the new xml file with the data. Could some one help me out in generating xml file with the data. Could anyone send me the java code that does this task.
Let me know which parser are you using currently for reading xml files so that i assist you. For now, you can refer to STAX Parser API under this link
http://java.sun.com/webservices/docs/1.6/tutorial/doc/SJSXP3.html -
Make a sort with ODI while generating XML File
Hi all,
I made a package whith several interfaces and a treatment.
Each interface targets a table in my XML schema and the final treatment is a CreateXMLFile.
Everything goes well, my XML file is generated :D
Now I'd like to make a sort in an XML element. I know how to order the elements between them but can't find a way to sort a specific element. Excuse my poor english, I'm not really clear...
My XML is built like this :
<root>
<questions>
<question>
<questionnumber>1</questionnumber>
</question>
<question>
<questionnumber>2</questionnumber>
</question>
<questions>
<root>
So my problem is to make the questionnumber ordered.
I tried to modify the IKM SQL Incremental Update to add a ORDER BY in the "Insert new rows" step.
The generated code is executed with success... but in the end, my XML file is not sorted :S
So first question, do you have an idea to be able to view the data in my XML schema tables ? This schema is stored in the memory engine and not in an external base. I ask that because when you try to execute the query "select * from XMLSchema.XMLTable" in the Operator, it appears you get the datas you had when the schema had been reversed. Idem when you try to view the datas in datastore. So first of all I'd like to do this control to be sure my order by is taken into account.
Second question, do you know how the Odi XML driver builds the XML File with the command CreateXMLFile, because I think that my XML table is well sorted but that the CreateXMLFile doesn't repect this order. I checked the driver tutorial but couldn't find any help on that subject.
So if anyone has got an idea to help me, I would appreciate a lot.
Thanks,
ThierryStill searching but without success
Maybe you are looking for
-
How to connect apple tv 2 to pioneer pdp s35
How do I connect apple tv 2 to pioneer pdp.s35 tv? I connected to one of my pioneer receiver's hdmi ports but when I cycle through the inputs I can't find apple tv. Thanks.
-
Hello, I've looked for answer, read all the articles about making better performance of PS and I still can't solve the problem... I even tried Photoshop CC and the performance was... worse. I measured time it took to open some files or make some of m
-
[SOLVED] GNOME Shell 3.4 : Volume Control Missing
Hi all, I have an Acer netbook with Arch Linux i686. I installed GNOME-Shell 3.4, but there is no volume control applet. When playing music, i can't control the volume. Can you help me? (Sorry for my bad English) Last edited by masnormen (2012-06-05
-
The whole of my headphone jack snapped off and when I mean the whole thing I literally mean the whole jack how do I get it out as I don't really want to pay hinder of pounds to get it fixed , thanks a lot
-
Why are my actions not processing the RAW files correctly?
For starters, I have to say the CS4 has been one of the most unreliable software packages I've ever used. It's a beta version. Adobe is making Microsoft look good these days. I was extorted into upgrading from CS3 because Adobe chose not to create