How to create xml file from original

Advertisement

I have this complicated xml and I want to search through it and make a new xml with only element I find that match. what is the best way to do this? the file
is about 6mb and I want to read the whole file easily..should i load to database table and create a file from table? I have found issues reading the file..
- <ArrayOfJobClass xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <JobClass>
- <Triggers>
- <TriggerClass>
<ExpireActionType>Delete</ExpireActionType>
<ExpireType>DateTime</ExpireType>
<TriggerType>TimeType</TriggerType>
- <TTime>
<TimeTriggerType>Custom</TimeTriggerType>
<IntervalType>Daily</IntervalType>
<SpecificType>Days</SpecificType>
<FirstLastType>First</FirstLastType>
<IntervalValue>1</IntervalValue>
<FirstLastWeekDay>Monday</FirstLastWeekDay>
<InitDate>2009-05-04T14:17:05.40625-07:00</InitDate>
- <IntervalDays>
<boolean>false</boolean>
<boolean>false</boolean>
<boolean>false</boolean>
<boolean>false</boolean>
<boolean>false</boolean>
<boolean>false</boolean>
<boolean>false</boolean>
<boolean>false</boolean>
<boolean>false</boolean>
<boolean>false</boolean>
<boolean>false</boolean>
<boolean>false</boolean>
<boolean>false</boolean>
<boolean>false</boolean>
<boolean>false</boolean>
<boolean>false</boolean>
<boolean>false</boolean>
<boolean>false</boolean>
<boolean>false</boolean>

Advertisement

You can load it in the database in an XMLType table (Object-Relational or Binary XML storage), use XQuery on the XML content and then write back the result to a file.
Or, you might just use an external processor (XSLT or XQuery).
If you want to stay in the Oracle world, you can use :
- For XSLT : $ORACLE_HOME/bin/oraxsl (it's a wrapper for the java XSLT engine)
- For XQuery : the java XQuery API
Personally, I sometimes use the Saxon XSLT and XQuery processor, quite efficient.
Here's a simplistic example with oraxsl utility :
emp.xml
<?xml version="1.0" encoding="UTF-8"?>
<emps>
  <emp id="7369">
    <name>SMITH</name>
    <job>CLERK</job>
    <salary>800</salary>
  </emp>
  <emp id="7499">
    <name>ALLEN</name>
    <job>SALESMAN</job>
    <salary>1600</salary>
  </emp>
  <emp id="7521">
    <name>WARD</name>
    <job>SALESMAN</job>
    <salary>1250</salary>
  </emp>
  <emp id="7566">
    <name>JONES</name>
    <job>MANAGER</job>
    <salary>2975</salary>
  </emp>
  <emp id="7654">
    <name>MARTIN</name>
    <job>SALESMAN</job>
    <salary>1250</salary>
  </emp>
</emps>
emp.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="text()"/>
<xsl:template match="emps/emp[job='SALESMAN']">
  <xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>Applying the transformation to search and extract all "salesmen" :
D:\ORACLE\test>%ORACLE_HOME%\bin\oraxsl emp.xml emp.xsl result.xml
D:\ORACLE\test>type result.xml
<?xml version = '1.0' encoding = 'UTF-8'?>
<emp id="7499">
    <name>ALLEN</name>
    <job>SALESMAN</job>
    <salary>1600</salary>
  </emp><emp id="7521">
    <name>WARD</name>
    <job>SALESMAN</job>
    <salary>1250</salary>
  </emp><emp id="7654">
    <name>MARTIN</name>
    <job>SALESMAN</job>
    <salary>1250</salary>
  </emp>

October 11, 2015

How to create xml file from original

I have this complicated xml and I want to search through it and make a new xml with only element I find that match. what is the best way to do this? the file is about 6mb and I want to read the whole file easily..should i load to database table and c

How to create xml file from relational tables in 10gR2

Hi, I am very new to XML and was wondering how to create an XML file from querying relational tables. Some child tables may contain multiple rows that need to be returned in certain instances. Other queries will just be single or multiple rows from o

Create XML File from a specified XSD file

Hi, I'd like to create an XML document with java. BUT How can we "bind" this creation with a XSD file. Hence, the creation may fail if the XSD binded file is not respected. So I know how to create XML file but not bind to this creation my proper

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;

Create XML file from XSD

Hello, can anybody help me with generating an empty tagged XML file from a XSD file. Any sample java code will be highly appreciated. Thanx in advance. A .Apache XML Beans presents a way to compile the XSD Schema and generate Java classes for each el

How to Generate XML File from Java Code.

I want to generate the xml file from the java code. Could you plz suggest any webSite address with example?Here is the code import java.io.File; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.x

Please Help. Trying to create XML file from 2 tables.

Step1: Target XML format Created an XML <DEPART> <DEPARTMENT_ID>10</DEPARTMENT_ID> <DEPARTMENT_NAME>Administration</DEPARTMENT_NAME> <MANAGER_ID>200</MANAGER_ID> <LOCATION_ID>1700</LOCATION_ID> <EMP

How to Create XML Schema From JTree ?

Please help me... Thank you. This is Code Tree.java ----- Run This File import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.J

Create .xml file from a java file

I wanted to know how can we create a .xml file through java with the given data. For example: book saler. data given through java are 1)Sl no 2)Book name 3Book type 4)Book price i want a xml file generated through the java code can anyone help me out

How to Create PDF files from XSL-Fo

Hi all, I have in my KM content many XML files, and I want to export the content to PDF. Hi have the XSLT file, but some one could help me how to integrate this with FOP? Thank youHi Joao,                 Verify these links hope it may helps... http:

How to create MUSE file from existing MUSE site?

Hi- A customer has a site that was created with MUSE and she wants some edits made to it. I have installed MUSE and can access the server via FTP. I've downloaded the site's html files and assets, but these are useless in MUSE. How do I create or get

Create XML file from java

Hi all i am working to create a XML file using java can any one show me some sample code how to do soAll I suggested was to insert a single line ("X.serialize(root);") into your code. Anyway, here's a ready-to-compile source code based on yours.

How to update XML file from the program

i am new in abap , and i have the following issue,so plz anyone who knows how to do it Background : An XML file is used as the datasource for a Flex Application. From time to time this requires updating with new staff details. i have already saved th

Create XML file from SQL trigger

I have to create a XML file of a record when a certain column of table Absences is updated. I have the following bcp command in the (after update) trigger :     bcp "select absences.HID, absences.Amount,absences.Itemcode,absences.Itemcount, absences.

How to create .csv file from ABAP report

Hi We have a requirement to generate .csv file from abap report. Currently user saves data from abap report to spreadsheet(.xls format) in desktop.  Then opens excel file and save as .csv format.  Need option to save directly in .csv format instead o

How to generate xml file from an array of data using jQuery

Hi All, Iam facing the problem with diaplaying array of data into a xml file, Actually iam using SAPUI5 commons table to display the backend data, each row in the table has checkbox. If we select each checkbox, iam getting the particular record and p

Creating XML files from one data file in a java program

<statement>      <name>John Dow </name>      <address>123 Main</address>      <phone>972-213-3434</phone> </statement> <statement>      <name>Jane Dow </name>      <address>345 Main&l

XML File from SQL Query

I have created XML File from Query using below function:- select dbms_xmlgen.getxml(' select * from tblreports where rownum<=1') from dual; "(CLOB) <?xml version="1.0"?> <ROWSET> <ROW> <REPORTID>preRES0011</REP

To fetch XML files from database  AND regarding barcodes

Hi !! I am very new to this forum...this is my first mail to this forum... 1.) Actually I would like to know how to fetch XML files from database and then how to get the datas from that XML files???Right now i am using struts frame work...If u anyone

Create xml file in iOS

How to create xml file in iOS and how to send data to web using SOAP protocol.How do you create xml files in iOS and how do you send data to the web using a SOAP protocol? Is that what you meant to say?Read other 3 answers