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,
Suseelan

Use 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

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,
    Deepa

    Hi,
    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...

  • Problem about .xml file from PPro CS5 to FCP with RED and P2 file.

    I have create a Project in Premiere Pro CS5.
    I import the RED file R3D or P2  file XMF and editing my media.
    From menù File i select Export to "Final Cut Pro XML.."
    I open FCP and Import file XML but the media are not reconnect.
    "Warrnig: Non-critical error were found while processing an XML document.
    Would you like to see a log of these error now?"
    I want see the log file and...
    "<file>: Unable to attach specified media file to new clip."
    Where is the problem?

    Hi Dennis I re-format my MACPRO 8 Core and I installed Final Cut Studio Suite and CS5 Premium (no CS4)
    I install Blackmagick driver Decklink 7.6.3
    If I open the After Effects  and setting preview card blackmagic, I see the preview in external monitor.
    If I open the Premiere Pro and setting preview, I don't see the blackmagic card but the second monitor, DV....etc.
    In Premiere I see the blackmagic preset, but no the preview card.
    I have a second question.
    About Red file I want editing in Premiere Pro and i whant color correct in Apple Color from FCP.
    My problem is: my color program crash when I send file form FCP to Color (random mode)
    The sequence is:
    I import file red in PPro5 -- editing file --- export file xml.
    Close the PPro5.
    Open FCP import xml (no re-link media)
    Save de project in FCP
    Select sequence and send to Color.
    In this moment the Apple Color crash.
    I shutdown the MAC.
    I power-up the MAC
    Open FCP select the project and send the sequence to Color.
    Color see the project but no media.
    I re link the media and I editing in color my media.
    Why Apple Color program crash?
    Sorry for my English
    Many Thanks
    Distinti saluti
    Gianluca Cordioli
    Alchemy Studio'S di Gianluca Cordioli
    Via Pacinotti 24/B
    37135 VERONA
    cell.:+39 3385880683
    [email protected]
    www.alchemystudios.it

  • Question about XML file transferring over the networking

    Hi, I am now to Java, and now I am going to set up a simple network in the lab.
    I have created a random array of data and transferred to XML file on my client. Now, I would like to send it to the server. I am wondering how I can put the XML file into my client, and do I need any parser to let the server show what random date it has received?
    Anybody can give me any idea or some basic code? Thank you.
    Now, I am referring the KnockKnock example in Java online tutorial. But, not clear how to deal with the XML File.
    Fengyuan

    Four crossposts.
    http://forum.java.sun.com/thread.jspa?threadID=5158198&messageID=9600070#9600070
    http://forum.java.sun.com/thread.jspa?threadID=5158200&messageID=9600074#9600074
    http://forum.java.sun.com/thread.jspa?threadID=5158201&messageID=9600076#9600076
    http://forum.java.sun.com/thread.jspa?threadID=5158202&messageID=9600078#9600078

  • About XML file operation

    I want to get the configuration of my programme by reading the XML file.But I am not familiar with the class of handling XML file in java.Someone can give an example to me and simply explain.Thank you very much.

    That link over at the left there, the one that says "Tutorials"? Follow it to a page full of tutorials. From that page follow the link to the tutorial about Web Services.

  • 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/)

  • 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,
    Prakash

    It 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

  • 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 advice

    There 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 in Java

    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

  • 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 advice

    Hi 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

  • XML File Generation

    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
    Thanks

    There 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.

  • Little doubt about xml and jspx, someone would give me a explaiation please

    Hi!!
    What's the diference between a .jspx and .xml file? do they have the same porpose? can I replace a .jspx for .xml file ?
    Thanks!!!

    If you can't get AOL to talk you thru it, then it's time to stop using AOL.
    You are paying extra for a useless service. You already pay (and HAVE TO PAY) to the internet company that gives you the internet modem and conneciton to the internet, and they are be giving you 1-5 free email addresses with that account. (call them if you never set them up).
    There is no guarantee you don't have a problem with your mail setup on your computer, but this is the right time for you to set up your [email protected] accounts, download all your AOL mail including your address book (FROM AOL'S WEBISTE via Safari) to your hard drive, make sure you are using an external drive with Time Machine and doing daily if not hourly backups, and start sending emails to your friends and family and business from the new mail account(s).
    Otherwise you can call someone who saves computers and AOL accounts for a living and pay them $25- $100 hour....

  • 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. :-)

  • Basic doubt about Primary Key/Foreign Key in Oracle Tables

    Hi,
    I have a doubt whether Primary Keys/Foreign Keys are allowed in Oracle. Some of the people I know are telling me that Oracle does not encourage having Primary Keys/Foreign keys in its database tables.
    However if I go to the ETRM and look for information about some of the Oracle Tables, I am informed that Primary Keys do exist. However I am being told that ETRM is not a reliable way of having correct information about table structure.
    It would be great if any one of you provides me with some insight in this. Any pointers to a document would be great.
    Thanks

    It is not that PK/FKs are disallowed in Oracle Apps (there are some on the standard Oracle Apps tables), but they are typically not used. I am not positive what the logic behind this is, but my guess is that it was party due to the earlier versions of Oracle Apps pre-dating declarative database referential integrity in Oracle DB and also on performance issues with the standard referential integrity with the earlier versions of declarative database referential integrity.
    As far as eTRM is concerned - I understood that the data is based on a design repository rather than a physical Oracle Apps DB. So all of the information in there is logically correct, but not necessarily enforced via the standard Oracle DB declarative referential integrity (rather by the application code or APIs).

Maybe you are looking for

  • How can I delete an authorized computer from my account, but I want to still have one of the 2 I have

    I made use of some computer to managed my apple account but later I sold this computer; then I bought another computer and I autorized this one but I didn't know I must delete the computer I made use before. Now I want to delete it but in the apple a

  • How to make a Countdown timer Script for Live Streaming

    I have flash media server... Here's a Scenario: User wants to do a Live broadcast.. But.. they don't want to just press record and have it starting Streaming Right that second. They need a Delay to prepare for their Live Broadcasts. Whats the best wa

  • LV 7.3 and up: How to edit clusters being passed to sub VIs?

    Hello, Here is what I've been doing: In an effort to keep VIs neat and clean I've been passing clusters to subVIs.  In order to update the cluster from the subVI I've followed this procedure: 1. Create a reference to the cluster 2. Drag the reference

  • Dust under screen - Curve 8330

    I've had my BB Curve 8330 for almost two months now and I love it expect I've noticed a lot of dust is collecting under the screen.  I've tried using compressed air to remove it but with little success.  I contacted my service provider (Alltel) about

  • Distiller printer

    Using Acrobat 7 Standard with XP.  When Acrobat installed, the distiller printer did not install.  Can reinstallation fix?