Example xsl to transform database table to xml

Hi All,
I am looking for sample xsl to transform database table to xml.
Thanks in Advance.

ODI does not use XSL for transforming DB Data into XML.
It uses a built-in JDBC Driver for XML files. The XML file appears like a DB Engine. At the end of the day, it is more like JDBC to JDBC data transfer.
Regards,
-FX

Similar Messages

  • How to convert database table into xml file

    Hi.
    How to convert database table into XML file in Oracle HTML DB.
    Please let me know.
    Thanks.

    This not really a specific APEX question... but I search the database forum and found this thread which I think will help
    Exporting Oracle table to XML
    If it does not I suggest looking at the database forum or have a look at this document on using the XML toolkit
    http://download-east.oracle.com/docs/html/B12146_01/c_xml.htm
    Hope this helps
    Chris

  • Persist XML Data to Database Table - Generic XML Schema

    Hi,
    I would like to represent data in XML format and persist to any database tables.
    The ideal xml is like:
    <TABLE NAME="TABLE1">
    <TABLEDEF><COLUMN NAME="COLUMN1"/><COLUMN NAME="COLUMN2"/></TABLEDEF>
    <ROW><COLUMN VALUE="value1"/><COLUMN VALUE="value2"/></ROW>
    <ROW><COLUMN VALUE="value11"/><COLUMN VALUE="value22"/></ROW>
    </TABLE>     
    <TABLE NAME="TABLE2">
    </TABLE>     
    The XML could then be parsed, and saved to database with JDBC by manually composing the statement strings.
    To reduce the coding effort (xml parsing, JDBC connection, etc), are there any open source projects available to achieve the above purpose? The popular O/R mapping tools like Hibernate, Castor, etc, can't handle this scanario because they require the knowledge of the tables on the server side in order to create the mapping files in advance.
    Thanks for the help!

    Hi,
    I would like to represent data in XML format and persist to any database tables.
    The ideal xml is like:
    <TABLE NAME="TABLE1">
    <TABLEDEF><COLUMN NAME="COLUMN1"/><COLUMN NAME="COLUMN2"/></TABLEDEF>
    <ROW><COLUMN VALUE="value1"/><COLUMN VALUE="value2"/></ROW>
    <ROW><COLUMN VALUE="value11"/><COLUMN VALUE="value22"/></ROW>
    </TABLE>     
    <TABLE NAME="TABLE2">
    </TABLE>     
    The XML could then be parsed, and saved to database with JDBC by manually composing the statement strings.
    To reduce the coding effort (xml parsing, JDBC connection, etc), are there any open source projects available to achieve the above purpose? The popular O/R mapping tools like Hibernate, Castor, etc, can't handle this scanario because they require the knowledge of the tables on the server side in order to create the mapping files in advance.
    Thanks for the help!

  • Define Object type(s) to transform relational tables to xml

    I have the Object type and query defined below and output. My problem is that I want to add an attribute to the CLM_MNGT_PROC_STEP_TYPE_NAME node in the XML. The samples I am using from OTN only show either an attribute or a nodevalue, not both.
    CREATE OR REPLACE TYPE CONTEXTSTATECLAIM_TYPE AS OBJECT
    "@error" VARCHAR2(1),
    "CONTEXT_STATE_ID" VARCHAR2(36),
    "CONTEXT_TYPE_CODE" VARCHAR2(10),
    "CLM_MNGT_PROC_STEP_TYPE_NAME" VARCHAR2(50),
    "BATCH_NAME" VARCHAR2(30),
    "DATE_OF_SERVICE" DATE,
    "PATMRN" VARCHAR2(20),
    "PROVIDER_NAME" VARCHAR2(50),
    "MEMBER_NAME" VARCHAR2(50),
    "ASSIGNEDTO_NAME" VARCHAR2(50),
    "LOCKED" VARCHAR2(1)
    SELECT sys_xmlagg(
    sys_xmlgen(
    CONTEXTSTATECLAIM_TYPE(
    DECODE(context_state.xerror_id,NULL,'N','Y'),
    context_state.context_state_id,
    context_state.context_type_code,
    clm_mngt_proc_step_type.priority_indicator || clm_mngt_proc_step_type.clm_mngt_proc_step_type_name,
    --                         clm_mngt_proc_step_type.color,
    context_state.batch_name,
    context_state.date_of_service ,
    context_state.patmrn,
    context_state.provider_name,
    context_state.member_name,
    office_user.user_name,
    DECODE(context_state.lockedby_id,NULL,'N','Y')
    ),sys.xmlgenformattype.createFormat('CLAIM')
    ), sys.xmlgenformattype.createFormat('CLAIMS')
    ).GETCLOBVAL() "XML"
    FROM context_state,
    office_user,
    clm_mngt_proc_step_type
    WHERE context_state.assignedto_id = office_user.user_id (+)
    AND context_state.clm_mngt_proc_step_type_code = clm_mngt_proc_step_type.clm_mngt_proc_step_type_code
    AND context_state.office_id = '99'
    <?xml version="1.0"?>
    <CLAIMS>
    <CLAIM error="N">
    <CONTEXT_STATE_ID>34A5ED94-569E-49C0-904E-7483BFF566CE</CONTEXT_STATE_ID>
    <CONTEXT_TYPE_CODE>SAVECLAIM</CONTEXT_TYPE_CODE>
    <CLM_MNGT_PROC_STEP_TYPE_NAME>Phys.Not Found</CLM_MNGT_PROC_STEP_TYPE_NAME>
    <BATCH_NAME>20020122-1049</BATCH_NAME>
    <DATE_OF_SERVICE>22-JAN-02</DATE_OF_SERVICE>
    <PATMRN>03NMF87661234</PATMRN>
    <PROVIDER_NAME>Hamilton, D.R.</PROVIDER_NAME>
    <MEMBER_NAME>Collins, Jane</MEMBER_NAME>
    <LOCKED>N</LOCKED>
    </CLAIM>
    <CLAIM error="N">
    <CONTEXT_STATE_ID>D8C484E7-D413-43CF-B2F4-796B4778C00E</CONTEXT_STATE_ID>
    <CONTEXT_TYPE_CODE>SAVECLAIM</CONTEXT_TYPE_CODE>
    <CLM_MNGT_PROC_STEP_TYPE_NAME>Phys.Not Found</CLM_MNGT_PROC_STEP_TYPE_NAME>
    <BATCH_NAME>20020122-1049</BATCH_NAME>
    <DATE_OF_SERVICE>22-JAN-02</DATE_OF_SERVICE>
    <PATMRN>03NMF45385225</PATMRN>
    <PROVIDER_NAME>Willford, M.</PROVIDER_NAME>
    <MEMBER_NAME>Thomas, Lisa</MEMBER_NAME>
    <LOCKED>N</LOCKED>
    </CLAIM>
    </CLAIMS>

    Please follow the discussion in the following thread
    How does XML DB transform a Schema into object-relationals tables?

  • Xml, xsl, java and database

    I have several xml documents that uses different tags to describe the same type of information. In my case they describe a row in a database table.
    file1.xml
    <therow>
    <name>Jones</name>
    <title>manager</title>
    </therow>
    file2.xml
    <arow>
    <employee>King</employee>
    <job>manager</job>
    </arow>
    I want to use a technology for reading the content of the two files and generate a new document for each file that will use generic tags so the content of the new files could look like:
    file1
    <row>
    <employeename>Jones</employeename>
    <employeetitle>manager</employeetitle>
    </row>
    file2
    <row>
    <employeename>King</employeename>
    <emplyeetitle>manager</employeetitle>
    </row>
    An then I can read this information by using a generic Java class and insert it into the database table..
    I was told that the technology used for doing this was XSLT. I have been searching the web for examples and also tried to read some of the content in the Steve Muench book 'Building Oracle XML Applications'.
    I have managed to create XSL files, but I would really appreciate if someone could show me a real example of how to do this, with the xml file, the xsl file, and a small java program to read this. Can anyone help?

    Post your XSL files, otherwise we'd have to write them again.

  • Import/insert data from XML into Oracle database tables?

    Hi. (I am using JDeveloper 10.1.3.3.0 and Oracle 10g)
    I have been able to export the data from one of my database tables by using a View Object and .writeXML.
    Now, I want to take an xml file that is formatted in the same way as what is spit out by the writeXML and put that info in my database table. I followed online examples and have tried using .readXML like so:
    Element element = XMLDoc.getDocumentElement();
    vo.readXML(element, -1);
    I know it is sort of working, because at first I got an error message that one of the required attributes was missing. So, I added that attribute to my xml file and ran my code. No errors. But, I checked my database, and the new records were not added.
    Is there something I have done wrong? Or is there perhaps something I left out? I also noticed there were several versions of readXML like readFromXML. Which one should I use and how?
    Thanks.

    KUBA, I changed my code to match your example:
    DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
    File xmlFile = new File("C:/myfilehere.xml");
    Document doc = db.parse(xmlFile);
    Element element = doc.getDocumentElement();
    vo.readXML(element, -1);
    vo.getDBTransaction().commit();
    I still get no errors, but my database table has no new records.
    Any ideas why?
    Thanks.

  • Creating XML file using data from database table

    I have to create an xml file using the data from multiple table. The problem That i am facing is the data is huge it is in millions so I was wondering that is there any efective way of creating such an xml file.
    It would be great if you can suggest some approach to achieve my requirement.
    Thanks,
    -Vinod

    An example from the forum: Re: How to generate xml file from database table
    Edited by: Marco Gralike on Oct 18, 2012 9:41 PM

  • Load XML data from UNIX Server Directly into Relational Database Tables

    Is there a way I can load data from an XML File into Oracle Tables , without having the Input XML file in some Oracle Server Directory. My XML File resides on UNIX Application server. And I need to directly load the data into Database tables. Without loading them into the Database Directory.
    Also I am looking for a solution that would not load my Database much and effect other running processes. Can it be done using SQL Loader ?
    Oracle Database Version is : Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

    Thanks for your reply ,
    Please would you quote an Example about : 'Load the file into that table using SQL*Loader'  (From UNIX Server) Or instance of some existing thread that relates to my situation.
    The Size of the File would be about 3 GB. For a similar requirement one of my peers Code which used XMLTABLE and XPATH Approach consumed a lot of resources while running and caused the other Database Applications to slow down. Thus those guys have come up with an approach to :
            Parse XML using a C Code using some STRING Functions =>  For a CSV or Fixed width .dat file and then use SQL Loader to just load the file into Tables.
            This approach is efficient in terms of Resources and Time(Takes 5 mins). But I am not confident about parsing XML based on String based C Functions.
             Please comment about this approach . Also if possible Suggest the best efficient way of doing this.

  • Loading XML files into Database table

    Loading XML files into Database table
    Hi I have some XML files say 100 files in a virtual directory created using &quot;Create or replace directory command&quot; and those files need to be loaded into a table having a column of XMLTYPE. 1)How to load that using Oracle provided procedures/packages

    Check out the Oracle XDB Developer's Guide, Chapter 3. There is an example of using BFileName function to load the xml files from a directory object created using create or replace directory. It works really well.
    Ben

  • Generating xml file from database table

    Could anyone please explain how to generate a xml file from a database table.examples will be highly appreciated.
    thanks in advance

    See the release notes for our XSQL Pages component of the Java XDK for a tutorial. There are also lots of examples in Building Oracle XML Applications.
    You use the XML SQL Utility component to accomplish the task. It's part of our Java XDK that you can download from http://otn.oracle.com/tech/xml

  • Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the rows? Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the records?
    Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    The Oracle documentation has a good overview of the options available
    Generating XML Data from the Database
    Without knowing your version, I just picked 11.2, so you made need to look for that chapter in the documentation for your version to find applicable information.
    You can also find some information in XML DB FAQ

  • A query while  importing  an XML file into a Database Table

    Hi,
    I am Creating an ODI Project to import an XML file into a Database Table.With the help of the following link
    http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_11g/odi_project_xml-to-table/odi_project_xml-to-table.htm
    I am facing a problem while creating Physical Schema for the XML Source Model.
    For the
    Schema(Schema)
    and
    Schema(Work Schema) field they have selected GEO_D.
    What is GEO_D here??
    or
    What I have to select here?
    1) schema of the xml file (NB:-I havn't created any .xsd or .dtd file for my .xml file)
    or
    2)my target servers schema
    Please tell me what I'll do??
    Thanks

    and
    Schema(Work Schema) field they have selected GEO_D.
    What is GEO_D here??This is the schema name which is specified in the XML file .
    What I have to select here?
    1) schema of the xml file (NB:-I havn't created any .xsd or .dtd file for my .xml file)Yes
    2)my target servers schema
    Please tell me what I'll do??
    Thanks

  • What's the best way to create XML file with a schema from a database table?

    Hi,
    I want to create an XML file from a database table (which has over 600 columns) using XML schema (.xsd file). I want to know the best way to do this.
    The output XML file is NOT a direct data dump from the DB table, there�re some logic around it, such as the XML file has some hierarchy with repeating tags.
    I have done this using JAXB by creating Java classes form XML schema, but I don�t want to map 600 DB columns to these Java classes manually, and loop through the record set to create repeating tags.
    I know there are few tools around now like MapForce (Altova), how do people do these now?
    Thanks,
    Chandi

    Can you use a schema when we compose XML doc from Database tables?
    Actually, I'm using SQL Server (sorry, wrong forum). But, I thought a Java tool would have a solution for me.

  • Can we express batch relationship structure in XML in the database table

    Hi
    please help me ..
    i have a batch XML batch structure ...can we express batch relationship structure in XML in tha database table?
    yes..then how?
    Thanks
    Amu
    Edited by: amu_2007 on Mar 25, 2010 6:57 PM
    Edited by: amu_2007 on Mar 25, 2010 7:03 PM

    But what is the problem with the initial solution given that split the XML into the data?
    I mean you could do something like this?
    SQL> create table batch (customer    VARCHAR2(10)
      2                     ,cust_name   VARCHAR2(10)
      3                     ,cust_type   VARCHAR2(10)
      4                     )
      5  /
    Table created.
    SQL>
    SQL> create table section (customer    VARCHAR2(10)
      2                       ,sect_name   VARCHAR2(10)
      3                       ,sect_depend VARCHAR2(10)
      4                       )
      5  /
    Table created.
    SQL> create table job_sections (customer        VARCHAR2(10)
      2                            ,sect_name       VARCHAR2(10)
      3                            ,job_sect_name   VARCHAR2(10)
      4                            ,job_sect_depend VARCHAR2(10)
      5                            )
      6  /
    Table created.
    SQL> create table job (customer        VARCHAR2(10)
      2                   ,sect_name       VARCHAR2(10)
      3                   ,job_sect_name   VARCHAR2(10)
      4                   ,job_type        VARCHAR2(10)
      5                   ,job_sub_type    VARCHAR2(10)
      6                   ,job_depend      VARCHAR2(10)
      7                   )
      8  /
    Table created.
    SQL>
    SQL>
    SQL> insert all
      2    when batch_rn = 1 then
      3      into batch (customer, cust_name, cust_type) values (customer, cust_name, cust_type)
      4    when section_rn = 1 then
      5      into section (customer, sect_name, sect_depend) values (customer, sect_name, sect_dependency)
      6    when job_sections_rn = 1 then
      7      into job_sections (customer, sect_name, job_sect_name, job_sect_depend) values (customer, sect_name, job_sect_name, job_sect_dependency)
      8    when 1=1 then
      9      into job (customer, sect_name, job_sect_name, job_type, job_sub_type, job_depend) values (customer, sect_name, job_sect_name, job_type, jo
    10  --
    11  WITH t as (select XMLTYPE('
    12  <BATCH customer="ABC" name="ABC1" type="ABC_TYPE">
    13    <BATCH_SECTIONS>
    14      <SECTION name="X" dependency="NULL">
    15        <JOB_SECTIONS name="JOB1" dependency="NULL" >
    16          <JOBS>
    17            <JOB type="X" sub_type="xx" dependency="NULL" />
    18            <JOB type="X" sub_type="yy" dependency="NULL" />
    19            <JOB type="X" sub_type="zz" dependency="NULL" />
    20          </JOBS>
    21        </JOB_SECTIONS>
    22      </SECTION>
    23      <SECTION name="Y" dependency="X">
    24        <JOB_SECTIONS name="JOB2" dependency="X" >
    25          <JOBS>
    26            <JOB type="Y" sub_type="xx" dependency="X" />
    27            <JOB type="Y" sub_type="yy" dependency="X" />
    28            <JOB type="Y" sub_type="zz" dependency="X" />
    29          </JOBS>
    30        </JOB_SECTIONS>
    31      </SECTION>
    32      <SECTION name="Z" dependency="Y">
    33        <JOB_SECTIONS name="JOB3" dependency="NULL" >
    34          <JOBS>
    35            <JOB type="....." sub_type="...." dependency="NULL" />
    36          </JOBS>
    37        </JOB_SECTIONS>
    38        <JOB_SECTIONS name="JOB4" dependency="NULL">
    39          <JOBS>
    40            <JOB type="...." sub_type="...." dependency="NULL" />
    41          </JOBS>
    42        </JOB_SECTIONS>
    43      </SECTION>
    44    </BATCH_SECTIONS>
    45  </BATCH>
    46  ') as xml from dual)
    47  --
    48  -- END OF TEST DATA
    49  --
    50  ,flat as (select a.customer, a.cust_name, a.cust_type
    51                  ,b.sect_name, NULLIF(b.sect_dependency,'NULL') as sect_dependency
    52                  ,c.job_sect_name, NULLIF(c.job_sect_dependency,'NULL') as job_sect_dependency
    53                  ,d.job_type, d.job_sub_type, NULLIF(d.job_dependency,'NULL') as job_dependency
    54            from t
    55                ,XMLTABLE('/BATCH'
    56                          PASSING t.xml
    57                          COLUMNS customer     VARCHAR2(10) PATH '/BATCH/@customer'
    58                                 ,cust_name    VARCHAR2(10) PATH '/BATCH/@name'
    59                                 ,cust_type    VARCHAR2(10) PATH '/BATCH/@type'
    60                                 ,bat_sections XMLTYPE PATH '/BATCH/BATCH_SECTIONS'
    61                         ) a
    62                ,XMLTABLE('/BATCH_SECTIONS/SECTION'
    63                          PASSING a.bat_sections
    64                          COLUMNS sect_name        VARCHAR2(10) PATH '/SECTION/@name'
    65                                 ,sect_dependency  VARCHAR2(10) PATH '/SECTION/@dependency'
    66                                 ,section         XMLTYPE      PATH '/SECTION'
    67                         ) b
    68                ,XMLTABLE('/SECTION/JOB_SECTIONS'
    69                          PASSING b.section
    70                          COLUMNS job_sect_name        VARCHAR2(10) PATH '/JOB_SECTIONS/@name'
    71                                 ,job_sect_dependency  VARCHAR2(10) PATH '/JOB_SECTIONS/@dependency'
    72                                 ,job_sections         XMLTYPE      PATH '/JOB_SECTIONS'
    73                         ) c
    74                ,XMLTABLE('/JOB_SECTIONS/JOBS/JOB'
    75                          PASSING c.job_sections
    76                          COLUMNS job_type        VARCHAR2(10) PATH '/JOB/@type'
    77                                 ,job_sub_type    VARCHAR2(10) PATH '/JOB/@sub_type'
    78                                 ,job_dependency  VARCHAR2(10) PATH '/JOB/@dependency'
    79                         ) d
    80            )
    81  --
    82  select customer, cust_name, cust_type, sect_name, sect_dependency, job_sect_name, job_sect_dependency, job_type, job_sub_type, job_dependency
    83        ,row_number() over (partition by customer order by 1) as batch_rn
    84        ,row_number() over (partition by customer, sect_name order by 1) as section_rn
    85        ,row_number() over (partition by customer, sect_name, job_sect_name order by 1) as job_sections_rn
    86  from flat
    87  /
    16 rows created.
    SQL> select * from batch;
    CUSTOMER   CUST_NAME  CUST_TYPE
    ABC        ABC1       ABC_TYPE
    SQL> select * from section;
    CUSTOMER   SECT_NAME  SECT_DEPEN
    ABC        X
    ABC        Y          X
    ABC        Z          Y
    SQL> select * from job_sections;
    CUSTOMER   SECT_NAME  JOB_SECT_N JOB_SECT_D
    ABC        X          JOB1
    ABC        Y          JOB2       X
    ABC        Z          JOB3
    ABC        Z          JOB4
    SQL> select * from job;
    CUSTOMER   SECT_NAME  JOB_SECT_N JOB_TYPE   JOB_SUB_TY JOB_DEPEND
    ABC        X          JOB1       X          xx
    ABC        X          JOB1       X          yy
    ABC        X          JOB1       X          zz
    ABC        Y          JOB2       Y          xx         X
    ABC        Y          JOB2       Y          yy         X
    ABC        Y          JOB2       Y          zz         X
    ABC        Z          JOB3       .....      ....
    ABC        Z          JOB4       ....       ....
    8 rows selected.
    SQL>But it would depend what you are actually after in terms of primary keys, and table relationships etc.
    Let me put this simply for you...
    h1. IF YOU DON'T DEMONSTRATE TO US WHAT OUTPUT YOU REQUIRE, WE CAN'T GIVE YOU AN ANSWER

  • Load different xml docs to same database table

    I have 2 different xml documents that contains the information about rows which should be loaded into a database table.
    File 1:
    <customer>
    <name>Company1</name>
    <city>Helsinki</city>
    </customer>
    File 2:
    <client>
    <clientname>Company2</clientname>
    <clientcity>Helsinki</clientcity>
    </client>
    The data in the 2 different files should be read and inserted as a row into the same database table.
    Instead of creating a java program for each xml file to insert the content into the database, I would like to first "translate" the content of the xml files and create a file for each xml file which uses the same tags, so that my java programs only reads the new "translated" files and inserts the data into the database.
    This means that when I receive a new xml file with different tags but information about a row that should be inserted into the same table, I just have to "translate" this file, and use the same java program to insert the new file data into the database.
    I would like to know which technology should be used to perform this task.

    XSLT is quite commonly used for this.
    Or, for more a formal approach, google 'xml "architectural forms"'
    Pete

Maybe you are looking for

  • A problem with vlan.dat retrieval in the RME

    Hello, the customer has LMS 3.1 and he uses RME for the backup of config files and vlan.dat files from netwrok devices. It is working fine, but he has problem with backuping vlan.dat files from the following switches: Cat2960-8TC,-24TC, Cat2960G-24TC

  • Ethernetdisk

    Hi, I just bought an ethernetdisk (Packardbell netstore). The disk is formatted in MS-DOS structure, My computer can 'see' the disk in the network. I tried to format the disk in another format UFS or HFS+, connected via usb to my iBook. But when I tr

  • Download of Installation Master DVD from service market Place

    Hi All, I did download the latest installation master DVD from market place but the SAPINST does not show up the steps to install a central instance. Can any one confirm the same, if it is a common issue and a problem with the SOFTWARE Uploaded into

  • 11 CS & CC update downloads instant fail (49)? - all others update ok.

    Using iMac OS X Yosemite 10.10.1 with Creative Cloud, eleven CS and CC updates constantly fail with "Download error. Press Retry to try again or contact customer support.(49)"  Updates never appear to start, they just instant fail with the above erro

  • Wireless conn not scaning wireless SSID automatically after stanby/hybernate

    Hi, I have cisco 1242 access point running WPA2/AES TKIP profile with EAP authentication in broadcast. I have dell laptops that have  3945ABG wireless card. The connection works when you configure the profile on laptop with windows wireless manager a