Automatic xml file generation
parsing xml file and then getting data from xml is ok but is there any api that support xml file generatoion from data itself
help plz
JDOM has an XMLOutputter.
DOM Level 3 allegedly supports outputting from the DOM itself.
However if you don't want to use JDOM, and you don't have access to DOM Level 3, there is a way to do it using transformers. I'm not sure if this is a trick or whether it's considered the standard way to do it.
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
Document dom; // this is what you want outputted
OutputStream stream; // this is where you want it outputted
Transformer identity = TransformerFactory.newInstance().newTransformer();
identity.transform(new DOMSource(dom), new StreamResult(stream));Note that it's not actually much code if you keep the identity transform around for reuse. JDOM's approach is a lot simpler though. :-)
Similar Messages
-
Error in XML file generation :240416
Hi All,
I am facing problem with XML file generation.
Steps:
1. Source-->Query Transform and maintained Nested Stucture
2. Generated XML fomat from query transform
3. Created XML format file
4. Make XML format as target and given XML generate path
source table-->Query(nested structure)-->XML Format
when I validate the job no errors found.
Note: XSD file is in Local mechine and XML file will be generated in SFTP.
Prooblems:
1. Getting below error
The input XML refers to file which is not part of the definition of this XML Schema format. Check your schema and XML files,
and check that the root element in the XML file corresponds to the root element in the XML Schema
Validate your XML Schema using external schema validators (found at w3.org)
Thanks,
DeepaHi,
I think issue Because in your Query Transform output the Root element is Query and XML target is having some other root element. Make the Query trasform name similar to root element and try... -
Hello,
I'm using XML files to communicate two systems. The XML files fulfill a W3C Schema.
I want to know if there is any Java library, API or something like this, to generate automatically XML files that fulfill a schema, giving the schema file and the data to fill the XML file.
Thanks,
Laura.Please use the code tags when posting code, as described in the formatting tips.
http://forum.java.sun.com/help.jspa?sec=formatting -
Automatic XML file import to CRM on Demand
Hi all,
I am new to CRM On Demand, and I need to set up a real-time automatic import of an XML file to CRM On Demand. I need the information to get entered as a new lead. If anyone has done this before and can guide me through the process, I would really appreciate it. I have done a few tests, but nothing has worked so far. I have no idea where to start.
Thanks!Hi, yes I only use jax-ws to generate client artifacts for On Demand. I can imagine for first time user you have really big problems to generate the client code... The reason for this is in most cases the size of the wsdl files.
What you can do is.
1. Think about what you really need of the selected wsdl. eg. if it is account do you need all related objects like PlanAccount etc?
2. If you know what you need start to delete the not needed definitions from the wsdl and try the generation of client afterwards.
Best Regards
SL -
Web.xml file generation problem
Hi,
I am trying to create web.xml file automatically using "java weblogic.marathon.ddinit.WebInit
" command.
I got the following message in the command prompt:
Found Web components. Initializing descriptors
filters=0 servlets=0 tags=0
Above command is creating the web.xml and weblogic.xml files but it is not including
the servlet-mapping information. why?
Thanks,
PrakashIt doesn't look like it found any servlets. You'd have to show me your
files if I'm to understand what's going on.
-- Rob
Prakash wrote:
Hi,
I am trying to create web.xml file automatically using "java weblogic.marathon.ddinit.WebInit
" command.
I got the following message in the command prompt:
Found Web components. Initializing descriptors
filters=0 servlets=0 tags=0
Above command is creating the web.xml and weblogic.xml files but it is not including
the servlet-mapping information. why?
Thanks,
Prakash -
Automatic XML output generation
i am trying to generate automatic xml output for a report. report dsnt take any parameters. i have written a xml definition
<report name="XML Report date spec GRFS03" DTDVersion="1.0">
<layout>
<section name="main">
<groupLeft name="G_LOC_CODE" >
<group>
<field name="LOC_CODE" source="loc_code"/>
<field name="QTTY" source="qty"/>
<field name="STK_NO" source="stk_no"/>
<field name="UNIT_COST" source="unit_cost"/>
<field name="USER_CODE" source="user_code"/>
</group>
</groupLeft>
</section>
</layout>
<customize>
<object name=”Gary D” type=”Report”>
//<properties>
//<property name=”beforeReportType”>File</property>
//<property name=”beforeReportValue”>C:\xmlreport.html
//</property>
</object>
</customize>
</report>
i have used SRW.APPLY_DEFINITION(xml_report.xml) for runtime customization but when i run report i get error : REP-6106: error in XML report definition at line 3 in 'xml_report.xml'
Root element name must match the DOCTYPE name.
can anyone suggest a solution to this?JDOM has an XMLOutputter.
DOM Level 3 allegedly supports outputting from the DOM itself.
However if you don't want to use JDOM, and you don't have access to DOM Level 3, there is a way to do it using transformers. I'm not sure if this is a trick or whether it's considered the standard way to do it.
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
Document dom; // this is what you want outputted
OutputStream stream; // this is where you want it outputted
Transformer identity = TransformerFactory.newInstance().newTransformer();
identity.transform(new DOMSource(dom), new StreamResult(stream));Note that it's not actually much code if you keep the identity transform around for reuse. JDOM's approach is a lot simpler though. :-) -
Hello all,
i am running invoice print selected invoices program in Receivables when i ran it i am getting Xml output code. now i want to send this code as a file (i.e., file.xml) through email automatically.
please advise me.
ThanksHello,
Maybe you should check if you can use Ant tool to do
that. I am not sure if it can help u.
Zeph.
http://ant.apache.org/
It will, specially if used in conjunction with XDoclets :
http://xdoclet.sourceforge.net/
XDoclet has Ant tasks to generate web.xml files. -
XML File Generation Issues using DBMS_XMLGEN
Hi,
I am using DBMS_XMLGEN package in a stored procedure to generate an XML file on Oracle 10 G R2 .But, the problem is the format in which the file is generated.
CREATE OR REPLACE TYPE "state_info" as object (
"@product_type" Number
CREATE OR REPLACE TYPE prod_tab as TABLE OF "state_info";
CREATE OR REPLACE TYPE state_t as object (
"state_code" CHAR(2),
"state_info" prod_tab
CREATE OR REPLACE PROCEDURE get_xml_serviced_state (p_clob OUT clob)
IS
v_xmlctx DBMS_XMLGEN.ctxhandle;
v_str VARCHAR2 (1000);
BEGIN
v_str := 'SELECT state_t(a.st_cd,CAST(MULTISET(select veh_type_id from svcd_st where st_cd =a.st_cd)as prod_tab)) as "state_info"
from svcd_st a where a.st_cd in (select distinct st_cd from svcd_st) group by a.st_cd having count(*)>=1';
v_xmlctx := DBMS_XMLGEN.newcontext (v_str);
DBMS_XMLGEN.setrowsettag (v_xmlctx,'serviced_state');
DBMS_XMLGEN.setrowtag (v_xmlctx,NULL);
p_clob := DBMS_XMLGEN.getxml (v_xmlctx);
printclobout(p_clob);
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
WHEN OTHERS
THEN
RAISE;
END;
SHOW ERRORS
Output :
<serviced_state>
<state_info state_code="VA">
<state_info>
<state_info product_type="2"/>
<state_info product_type="5"/>
<state_info product_type="9"/>
</state_info>
</state_info>
<state_info state_code="AB">
<state_info>
<state_info product_type="2"/>
<state_info product_type="5"/>
<state_info product_type="9"/>
</state_info>
</state_info>
</serviced_state>
Required it in below format:
<serviced_state>
<state_info state_code="VA">
<state_info product_type="2"/>
<state_info product_type="5"/>
<state_info product_type="9"/>
</state_info>
<state_info state_code="AB">
<state_info product_type="2"/>
<state_info product_type="5"/>
<state_info product_type="9"/>
</state_info>
</serviced_state>
I just need to put in all the rows under one single tag.Appreciate your early responses.
Thanks.Your wanted XML output is NOT VALID...(try it yourself on http://tools.decisionsoft.com/schemaValidate/)
-
Basic doubt about XML file generation
Hi,
I am new to Java. I am facing some trouble designing and implementing a particular problem involving XML files.
Problem:
I have an XML file which contains a set of properties and their default value. What I need to do is to read another file/stream which will have name=value strings and then, for all the names that I find there, change default value to current value. These names can appear in any order. For example,
<name1 value=default1/>
<name2 value=default2/>
<name3 value=default3/>
And I will get something like "set name3=value3 name1=value1" (This data comes to me from a stream -usb device- and not from a file). Then I should change it to
<name1 value=value1/>
<name2 value=default2/>
<name3 value=value3/>
What is the best possible way to do this in Java? This has to go into an embedded system so it will be nice if it can be done with minimum memory and less processing power.
I am currently reading J2EEtutorial (1.4). I have not read much. But I am confused if I should be using SAX, DOM or XSLT. To speak the truth, I don't even know the difference between all those. Any help will be greatly appreciated.
Thanks & Regards,
SuseelanUse a DOM parser to parse the original XML.
DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder domBuilder = domFactory.newDocumentBuilder();
Document document = domBuilder.parse( inputStreamToFile );Then read in the contents from your USB stream into say an array or Vector. Then go through each child node in the domBuilder class, get the nodes name and see if it's in the Vector of objects from the USB stream. If it is, then replace the "Value" attribute in the dom node with what is in the Vector.
Make sense?
Message was edited by:
bryano -
Wait XML File Generation and Present in APEX
Hi All,
I need advice on how can I implement following -
I will be creating Input XML file using database procedure called from APEX, which will then go and executed the call using web services and create output XML file in one of the output directory. What I need help is -
1. Once execute the initial call, then I need to be keep looking for file under output directory. Once the file is generated then I can show it on APEX, but I would like to know how can I implement, so continuously watch the directory for the file and as soon as file generated pick that file and present on APEX and stop watching directory for file.
2. Also APEX will be used by many users concurrently, so how can I create and direct unique file for their own sessions, so myfile should not go to another user?
Please adviceThere are lots of thread on ingesting XML and generating XML in this forum. Have a read through some of them and you should get some ideas on where to start. In particular look for threads on rcreating elational views of XML documents and using the SQL/XML Operators
-
XML File generation and watching continuously on directory present on APEX
Hi All,
I need advice on how can I implement following -
I will be creating Input XML file using database procedure called from APEX, which will then go and executed the call using web services and create output XML file in one of the output directory. What I need help is -
1. Once execute the initial call, then I need to be keep looking for file under output directory. Once the file is generated then I can show it on APEX, but I would like to know how can I implement, so continuously watch the directory for the file and as soon as file generated pick that file and present on APEX and stop watching directory for file.
2. Also APEX will be used by many users concurrently, so how can I create and direct unique file for their own sessions, so myfile should not go to another user?
Please adviceHi Keith
11g uses the EPG so the images are stored in the database, however are also accessible as a webfolder. This is the same as (or very similar to) XE which I've previously successfully installed this on. The files have been uploaded to the images directory as I'm able to reference /i/sample.html in the iframe successfully. I've never needed to change the .xml file and run apxldimg script, a simple copy and paste has always worked. However, I will try this just to make sure.
Hi Denes
I've tried putting in the absolute path of the directory, which I assume you mean the full path i.e. http://localhost:8080/images/charts_library. But this makes no difference. I know there are differences with 11g, the EPG and that you have to open http://localhost:8080/images/ as a web folder rather than http://localhost:8080/i/ to access the files in the images directory. However, the database that your example application on http://htmldb.oracle.com is running on is an 11g database. It's running 11.1.0.6.0 the same as my database, so it must be possible and by the fact you didn't know this I assume you didn't need to make any changes to make it work!
Sara -
How we can generate XML file using Oracle PL/SQL!!
We have oracle supplied packages for this!!! Which is preferable for printing table data into XML file!!!!
DBMS_XMLDOM
DBMS_XMLGEN
DBMS_XMLPARSER
DBMS_XMLQUERY
DBMS_XMLSAVE
DBMS_XMLSchema
DBMS_XMLStore
UTL_FILE
ThanksThere may be several alternative ways, but maybe the simplest way around is using object views and spool the data coming -
CREATE TABLE warehouse_table (
WarehouseID NUMBER,
Area NUMBER,
Docks NUMBER,
DockType VARCHAR2(100),
WaterAccess VARCHAR2(10),
RailAccess VARCHAR2(10),
Parking VARCHAR2(20),
VClearance NUMBER );
INSERT INTO warehouse_table
VALUES(5, 103000,3,’Side Load’,'false’,'true’,'Lot’,15);
CREATE VIEW warehouse_view OF XMLTYPE
– XMLSCHEMA “http://www.oracle.com/xwarehouses.xsd”
– ELEMENT “Warehouse”
WITH OBJECT ID
(extract(OBJECT_VALUE, ‘/Warehouse/Area/text()’).getnumberval())
AS SELECT XMLELEMENT(”Warehouse”,
XMLFOREST(WarehouseID as “Building”,
area as “Area”,
docks as “Docks”,
docktype as “DockType”,
wateraccess as “WaterAccess”,
railaccess as “RailAccess”,
parking as “Parking”,
VClearance as “VClearance”))
FROM warehouse_table;
SELECT VALUE(e) FROM warehouse_view e;
VALUE(E)
<Warehouse><Building>5</Building><Area>103000</Area><Docks>3</Docks><DockType>Si..
Best regards. -
Datalink sequence method (XML file generation problem using Rdf)
Hi All
I want to Generate XML File using RDF , Here i used 4 datablocks and i lilnked each datablock with datalink like 1 to 2, 1to 3 and 1 to 4 respectively. while executing the report it choosing only one link like 1 to 2 and writting the data in the file for the same. its not touching 3rd and 4th datablocks I need to have data for all the blocks that are available.
One more thing i want to close each blockonce the data is written in the file.But in this case the tags get open wites data goes to the other block write the data for this block come back to the first block and closes the block.
eg: <Start>
<First block>
<Second block>
<Third Block>
</Third block>
</second block>
</First block>
</Start>
My requirment is
<start>
<First block>
</First block>
<Second block>
</Second block>
<Third Block>
</Third block>
</Start>You might want to look at the SQL/XML operators XMLAGG, XMLELEMENT, XMLFOREST, XMLATTRIBUTES. They provide you with fine grained control over the XML generated.
-
Hi,
I am using
1. dbms_xmlgen.newContext to get the information from table.
2. After that I am using dbms_lob.createtemporary
3. Then I am using dbms_xmlgen.getXml
4. Finally I am using dbms_xmlgen.closecontext
I am using the above four steps to repatedly taking records from different tables.
My requirement is : Each and every time I am getting the <?xml version = '1.0'?>.
How to suppress <?xml version = '1.0'?> ?
Regards
SriniHi,
Use DBMS_XMLGEN.getXMLType to retrieve the XML data into an XMLType variable.
Then, with getClobVal method, you can convert it to CLOB :
SQL> DECLARE
2 v_xml XMLType;
3 v_lob CLOB;
4 BEGIN
5 v_xml := dbms_xmlgen.getXMLType('select * from scott.emp where rownum = 1');
6 v_lob := v_xml.getClobVal();
7
8 dbms_output.put_line(v_lob);
9 END;
10 /
<ROWSET>
<ROW>
<EMPNO>7369</EMPNO>
<ENAME>SMITH</ENAME>
<JOB>CLERK</JOB>
<MGR>7902</MGR>
<HIREDATE>17/12/80</HIREDATE>
<SAL>800</SAL>
<DEPTNO>20</DEPTNO>
</ROW>
</ROWSET>
PL/SQL procedure successfully completed -
XSD schema to xml file generation using C#
Hi fellow developers,
I need small help with my current scenario.
I have 2 xsd schemas one is input and other is output.
Now my requirement is based on those xsd template or structure, i need to write a C# code that takes the 1 xsd template as input in xml format and then do some mapping and then set that values to 2 xsd template in xml format.
Can you please guide or assist in this regards ??
It would be helpful if we have the flexibility of configuring the schema properties.Hi
Venky_Ferrari.
Based on your description, your case related to XMLXSD, SO I will move your thread to
Data Platform Development > XML, System.Xml, MSXML and XmlLite
forum for better support.
Best regards,
Kristin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.
Maybe you are looking for
-
I'm trying to connect a Belkin brand stereo audio cable from my MacBook Pro to a Sony flatscreen TV (Apple "genius" handed me the cable to purchase.) I have tried all the ports in the back of the Sony, and tried the volume on both the cable and TV r
-
Can't get 2 exchange accounts, even when push is off?
Is there no way to have 2 exchange accounts set up at the same time, even when push is off and I just check them manually? Why can't the phone simply check whichever account I choose when I open the mail app instead of limiting it to one account when
-
How do i transfer photos from ipad to pc running vista
how do i transfer photos from ipad to pc running vista
-
Does anyone know if I can transfer on my ipad 3 applications already purchased on my iphone 4?
Does anyone know if I can transfer on my ipad 3 applications already purchased on my iphone 4? Thanks a lot!
-
Use of group conditions in subtotal KZWIW
Hi, I have a specific trouble in the use of group condition in sales order and billing. Condition Z001 is a group condition and should also update field kzwi2 as base information for condition Z002 Condition Z002 is not a group condition and is calc