How I build XML dynamically?

Hello,
I'm new to JAXP and I have this problem. Perhaps someone can help me:
I have a database. I get data with many select-statements over some tables.
Now I want to get one XML-String/-File with the data. The Problem is, I have to cascade these data.
I have to build dynamically the XML-Tree.
Have someone an example?
Or do you know a good tutorial or website for jaxp?
Thanks!!!

from my database I get an resultSet and no XML-Data.personnaly, i wrote a class that takes every row of the resultset, and add a <row> </row> tags set to a string buffer.
in the <row> tag, I add a <collumnName> tag for each collumn, collumnName corresponding to the real collum name. You can easily get the collum names of an resultset...
This method works fine, but it is important to work with a stringbuffer, because if you make String s+="next" several times, you lose a large amout of time.
For example, a 4500 rows with 2 collums resultset containing string values in the fields makes 40 seconds to be build with the String objects, and 0.1 seconds with a stringbuffer...
Yours, Ga�l.

Similar Messages

  • How to iterate  xml dynamically using pl/sql

    Example :--
    example data will be stored in one column using clob.
    <?xml version="1.0"?>
    <PO pono="2">
    <PNAME>Po_2</PNAME>
    <CUSTNAME>Nance</CUSTNAME>
    <SHIPADDR>
    <STREET>2 Avocet Drive</STREET>
    <CITY>Redwood Shores</CITY>
    <STATE>CA</STATE>
    </SHIPADDR>
    </PO>
    HOw will you get dynamically for shipaddr
    2 Avocet Drive
    Redwood Shores
    CA
    With Regards,
    L.Rajesh
    Edited by: LRAJESH on Aug 30, 2010 9:52 AM

    You mentioned plsql...so here is an example iterating over POs:
    begin
    for rec in (with q as(select xmltype('<?xml version="1.0"?>
                                           <PO_LIST>
                                            <PO pono="2">
                                             <PNAME>Po_2</PNAME>
                                             <CUSTNAME>Nance</CUSTNAME>
                                             <SHIPADDR>
                                              <STREET>2 Avocet Drive</STREET>
                                              <CITY>Redwood Shores</CITY>
                                              <STATE>CA</STATE>
                                             </SHIPADDR>
                                            </PO>
                                            <PO pono="3">
                                             <PNAME>Po_3</PNAME>
                                             <CUSTNAME>Smith</CUSTNAME>
                                             <SHIPADDR>
                                              <STREET>5 West Drive</STREET>
                                              <CITY>San Francisco</CITY>
                                              <STATE>CA</STATE>
                                             </SHIPADDR>
                                            </PO>
                                           </PO_LIST>') the_xml from dual)  
                 select x.street, x.city, x.state
                   from q,  --your table here
                        XMLTable(
                         'PO_LIST/PO/SHIPADDR'   --note I have wrapped POs in a PO_LIST tag
                         passing q.the_xml  --your clob here
                         columns
                          street varchar2(1000) path 'STREET',
                          city varchar2(1000) path 'CITY',
                          state varchar2(1000) path 'STATE'
                        ) x)
      loop
       dbms_output.put_line(rec.street||' -- '||rec.city||' -- '||rec.state);
    end loop;
    end;Edited by: dmars on Aug 30, 2010 1:39 PM

  • How to  build a dynamic control  in 'as' file

    example :
    I want to build a dynamic CheckBox in as file (in
    flex2.0),who can help me! thanks

    thanks,i'm a chinese.I'm not be good at English.
    Now the problem have be settled.
    非常感谢你!

  • For a READ TABLE how to build a dynamic WITH KEY condition?

    Hi All,
    I have a Z table with 6 fields. The first field is the Plant and is the key field. This field can be matched with the field from selection screen. Now I have 4 character fields which can contain various values. Now I have another field at the end of the table and this field is the one which I will need for further processing.
    Now this last field will be selected based on the data for first 5 fields.
    This Read is performed in a loop and the data for all the 4 character fields may not be present.
    Now my problem is how to build a Read statement for this table where I need to get the value of the Last field based on the values of first 5 fields?

    Hi,
        Use
    IF    you have internal table With header line then use
          REad Tablename  with key  field1 = value1   field2 = value2      field3 = value3        field4 = value4    field5 = value5.
      If sy-subrc = 0.
    endif.
    if  you have internal table WithOut header line then use
         REad Tablename into workArea  with key  field1 = value1   field2 = value2      field3 = value3        field4 = value4    field5 = value5.
      If sy-subrc = 0.
    endif.
    regards,
    Amit

  • Building XML dynamically? Is it possible.

    How do I build an XML Document dynamically.?
    I am wrting MIDP Applications (applications for the Mobile
    device) and I am required to send requests to the server
    in XML Formats.I have multiple requests to be sent to the
    server in XML and then I receive XML responses from the server
    which i need to parse.
    Now,if I store all the required requests in a Class,that are needed to be sent to the server,I am taking a lot of space of the cell phone.
    How can I create an XML string dynamically that is sent to the
    server as and when required.
    Please can any one respond?
    AJAY
    ajay [email protected]

    Hi there,
    So is it possible for me to create an XM file on the fly.?
    For example: I need to send an xml file to the server
    For this I have a class called RequestHandler having a method called
    sendRequest1(),sendRequest2(),sendRequest3() etc etc
    public class Request{
    public void sendRequest()
    String req1 = "<xml.........>
    public void sendRequest2()
    req2 = "<xml......>";
    public void sendRequest3()
    req3 = "<xml...>";
    This way I have a lot of xml file format in each method.
    Please explain as to how I can create the XML file required
    to be sent for each request to the server on the fly.
    Storing this class with all the XML file formats takes up a lot
    of space on the MIDP device...
    Thanks for yr response.
    Ajay

  • Table name stored in another table and how to Build the Dynamic Query

    TblMasterTable
    Id
    Unqid
    Tbl_TemplateNameid
    Tbl_Template1
    Unqid
    Field1
    Filed2
    Tbl_Template2
    Unqid
    Field1
    Filed2
    Filed3
    Tbl_Template3
    Unqid
    Field1
    Filed2
    Filed3
    Filed4
    Filed5
    TblMasterTable contains the reference for the table names.
    TblMasterTable contains the data
    1 12     Tbl_Template1
    2 22     Tbl_Template2
    3 12     Tbl_Template1
    4 343 Tbl_Template3
    I want to build the query to retrieve all the Template table records based on the TblmasterTable data for a given id.

    This is possible but you need to understand the performance implications of Dynamic SQL before proceeding with this approach.
    <br>
    use this logic:<br>
    declare sqlstring varchar2(500):=null <br>
    select 'select stuff from '|| tbl_templatenameid into sqlstring from MasterTable where id=someid;<br>
    execute immediate sqlstring;
    <br>
    <br>
    I have really seen very few cases where this approach is justified.
    <br>
    <br>
    Dave<br>
    lehr.servehttp.com

  • Replaceregexp tag in build.xml to pass the value dynamically

    Hi,
    First of all I apologizes as this is not a java question, but sure you guys can help me out. In my build.xml, i have some thing like this:-
    <target name="all"
    depends="compile,clean_classes,replaceTemplates"/>
    <target name="compile"
    depends=" create.dir,compileclasses,jar,run"/>
         <target name="clean">
         <delete dir="${build.dir}"/>
         </target>
    <target name="clean_classes">
    <delete dir="${classes.dir}"/>
    </target>
    <target name="create.dir" depends="clean_classes">
    <mkdir dir="${classes.dir}"/>
    </target>
         <target name="replaceTemplates" depends="clean_classes">
              <replaceregexp file="${sourcefiles}/com/test/BusinessService.java"
                                  match="%%VALUE%%"
    replace="1"/> // this will be fetched dynamically from .properties
    </target>
    In my BusinessService.java,
    I have a String strValue = "%%VALUE%%";
    When i ran the build.xml, the strValue is not replaced with the value "1" as been specified in the build.xml. It seems that everything is fine the class file name path, etc. But some how it is not displaying the value "1" inplace of the placeholder? Please clarify.
    One more question on this:-
    If the value "1" is displayed for strValue variable, and if i have updated the value in the build.xml replace="2" for <replaceregexp>, in such case the updated value "2" wont be populated. Hence what is the approach we need follow, whether we need to create another folder and copy the "src" code there and make the changes in it like instead of:-
    <target name="replaceTemplates" depends="clean_classes">
              <replaceregexp file="${sourcefiles}/com/test/BusinessService.java"
                                  match="%%VALUE%%"
    replace="1"/> // this will be fetched dynamically from .properties
    </target>
    the new one will be like:-
    <target name="replaceTemplates" depends="clean_classes">
              <replaceregexp file="*${build}/*src/com/test/BusinessService.java"
                                  match="%%VALUE%%"
    replace="1"/> // this will be fetched dynamically from .properties
    </target>
    Please clarify.
    Thanks

    Don't be so impatient and don't multipost! I've deleted your other thread about the same topic.

  • How to build a full dynamic WHERE expression in ADFBC Faces View Object ?

    Dear Steve
    >
    I need an example about how to build a full dynamic WHERE expression in
    ADFBC View Object
    In UIX I known to do that, but i don't kwown how to do in ADFBC Faces.
    please help me to see an example.
    thanks
    Juan Carlos

    You write an AM level method to set the where clause and you expose it as a client method. (just like you did before)
    Then you can drag this method onto a page as a button and then pressing on this button will execute the method.
    If you want this to be done automatically without pressing a button - you go to the pagedef.xml file for your page and add a methodInvocation binding to that AM method, and then add a method executable to the executables section calling this method.

  • How to Build Attribute Dimension Dynamically & Load with LCM?

    Hi, I'm trying to modify the existing outline at cilent's site. For some reason, when I pulled the outline with extractor, it didnt come out in the format that is compatible with Outline Load Utility. I was told to use LCM so I may still load with minimal to no modification to the existing structure of outline.
    So can I build dimensions dynamically in EXCEL then load with LCM and push to Planning?

    The log came back with many unrecognized headers in the outline. I spoke to Oracle Support many times, and they said that the format of our outline is improper for Outline Load Utility to read.
    Since the outline has already been incorporated, we are not allowed to many any significant changes. That is why we were advised to use LCM.
    I tried to use a sample of one of the existing attribute dimensions in XML as the base and build the new attribute but it failed. I would appreciate if you can provide steps by steps resources to show how to add new attributes to the existing outline.

  • Ant: How to execute / skip tasks by property in build.xml ?

    Hi,
    I want to create a build.xml to execute / skip tasks dynamically by property in build.xml.
    eg: I can define one property "needObfuscate" in either "true" or "false". I will contruct 2 tasks for obfuscate and non-obfuscate to fullfill the 2 cases. Only one of them WILL be executed depend on the flag "needObfuscate".
    ** I know Antenna's task "wtkpackage" has an arguement "obfuscate" to set. It's an example, what I want to know is how to execute / skip the tasks.
    Task "condition" is just used to set the property in runtime.
    <condition property="result" value="User choose 001.">
    <equals arg1="001" arg2="${select}"/>
    </condition>
    There is other tasks can fullfill what I expect ?
    Please guide me how to make it.
    Thanks.

    Hi,
    I've done one build.xml like below:
    <?xml version="1.0"?>
    <project name="PropertyPromptExample" default="main" basedir=".">
    <target name="windowsTask">
    <echo>windowsTask</echo>
    </target>
    <target name="linuxTask">
    <echo>linuxTask</echo>
    </target>
    <target name="main">
    <input message="Please enter platform(0 Windows, 1 Linux):" addproperty="select"/>
    <condition property="platform" value="windowsTask">
    <equals arg1="0" arg2="${select}"/>
    </condition>
    <condition property="platform" value="linuxTask">
    <equals arg1="1" arg2="${select}"/>
    </condition>
    <antcall target="${platform}"/>
    </target>
    </project>
    :)

  • How to use Weblogic Server 6.1 build.xml with ant

    Hi Java's
    I have downloaded the latest version of BEA Weblogic server 6.1,they have changed the build.cmd to build.xml for compiling and building the ejb applications.they are telling that we have use $ant to run the build.xml but i couldn't able to do that.i'm getting "command not found error"..i'm using winnt.please help me how to use $ ant.Is it a seperate exe or batch file that i have to download ?if so where to download it.how to use it.please help.
    Regards
    Balaji

    To use it after installation, set your path to your
    <ant_installation_dir>\bin, then navigate to the diectory containing the build.xml. then follow the instructions in the weblogic documentation for running ant.

  • How to build a query dynamically....

    hi...i want to build a query dynamically. i don't want to build query by using string buffer. i want to create it directly by using sql query itself.
    my situation is like this....i have four drop down list in a page. The user can search the things based on one or two or three or four selected values.
    how to build a query for this kind of situation....pls let me know.
    Edited by: success_shiva6mca on Mar 3, 2008 12:39 PM

    there are two problems with building sql directly.
    1. it allows sql injection
    2.it allows XSS
    google them and you will understand if you dont already.
    I will recoment catching the values and using preparedStatements

  • Why not all jars picked up by ojdeloy and how to generate build.xml from command line and not JDEV GUI - quick question

    Hi All
    We have 11.1.1.7 ojdeploy to compile our app.
    We notice in the log that not all jars are used in classpath arguments when we explicitly set them up for compilation.
    eg:
      <path id="classpath">
        <pathelement location="../../Oracle/Middleware/oracle_common/modules/oracle.adf.share_11.1.1/commons-el.jar"/>
        <pathelement location="../../Oracle/Middleware/oracle_common/modules/oracle.adf.share_11.1.1/jsp-el-api.jar"/>
        <pathelement location="../../Oracle/Middleware/oracle_common/modules/oracle.adf.share_11.1.1/oracle-el.jar"/>
        <pathelement location="interface/public_html/WEB-INF/lib/a.jar"/>
        <pathelement location="interface/public_html/WEB-INF/lib/b.jar"/>
        <pathelement location="interface/public_html/WEB-INF/lib/c.jar"/>
        <pathelement location="interface/public_html/WEB-INF/lib/d.jar"/>
    </path>
    Log Output -
    [ora:ojdeploy] /path/to/Oracle/Middleware/jdk160_24/bin/javac
    [ora:ojdeploy] -g
      [ora:ojdeploy] -Xlint:all
      [ora:ojdeploy] -Xlint:-cast
    [ora:ojdeploy] -Xlint:-empty
      [ora:ojdeploy] -Xlint:-fallthrough
      [ora:ojdeploy] -Xlint:-path
      [ora:ojdeploy] -Xlint:-serial
      [ora:ojdeploy] -Xlint:-unchecked
      [ora:ojdeploy] -source 1.6
      [ora:ojdeploy] -target 1.6
      [ora:ojdeploy] -verbose
      [ora:ojdeploy] -encoding Cp1252
      [ora:ojdeploy] -classpath
    [ora:ojdeploy] /path/to/Oracle/Middleware/jdk160_24/jre/lib/resources.jar:
    [ora:ojdeploy] /path/to/Oracle/Middleware/jdk160_24/jre/lib/rt.jar:
      [ora:ojdeploy] /path/to/Oracle/Middleware/jdk160_24/jre/lib/jsse.jar:
        [ora:ojdeploy] /path/to/interface/public_html/WEB-INF/lib/a.jar"/>
        [ora:ojdeploy] /path/to/interface/public_html/WEB-INF/lib/c.jar"/>
    1- Is it because it depends on how jpr or jws are configured ?
    2- How can we automatically generate a build file of the application from command-line (as opposed to using Jdev IDE to click to generate a build.xml) ?

    The first  warning is happening because you're stating drivers for input devices without need. You haven't disabled hotplug so evdev gets used instead of kbd. This is normal, and you should change the driver line from kbd to evdev so that whatever options (if any) you've specified for the keyboard get parsed.
    The second warning is about you not installing acpid.
    The third I have no idea about, but look at the synaptics wiki. None of the (WW) are related to your video card.
    And every card that has 2 or more output ports show up as "two cards". You also don't need to specify the pci port in xorg.conf. edit: this is the general case with laptops, might be different for desktops.
    When I do lspci -v I get:
    00:02.0 VGA compatible controller: Intel Corporation Mobile 945GME Express Integrated Graphics Controller (rev 03) (prog-if 00 [VGA controller])
    Subsystem: Micro-Star International Co., Ltd. Device 0110
    Flags: bus master, fast devsel, latency 0, IRQ 16
    Memory at dfe80000 (32-bit, non-prefetchable) [size=512K]
    I/O ports at d0f0 [size=8]
    Memory at c0000000 (32-bit, prefetchable) [size=256M]
    Memory at dff00000 (32-bit, non-prefetchable) [size=256K]
    Expansion ROM at <unassigned> [disabled]
    Capabilities: <access denied>
    00:02.1 Display controller: Intel Corporation Mobile 945GM/GMS/GME, 943/940GML Express Integrated Graphics Controller (rev 03)
    Subsystem: Micro-Star International Co., Ltd. Device 0110
    Flags: bus master, fast devsel, latency 0
    Memory at dfe00000 (32-bit, non-prefetchable) [size=512K]
    Capabilities: <access denied>
    And it doesn't matter if it errs in trying to sli up with it self. That's just not a possibility.
    Last edited by gog (2009-10-15 23:59:49)

  • How to create a build.xml file ??

    Hi there,
    I am learning j2ee at the moment. I have been throught the tutorial and got everything working (finally). however, now that I have started writing my own code, I am stuck with writing the build.xml file (as this is not covered in the tutorial, it is just provided). Does anyone know a good link that will give me step by step instructions on how to create my own build.xml file for my application.
    thanks

    You need to learn ant. Go here:
    http://jakarta.apache.org/ant/
    I also recommend "Java Development with Ant" by Hatcher and Loughran, just published.

  • How to include .xml file while building a stand alone applicatio​n .exe file from a Labview program

    HI,
    I have a labview program which loads default values of all the variables from a .xml file when executed.  I am trying to build a standalone '.exe application'  using
    (Tools Menu --> Build Application from VI) , however I am not sure where to include this .xml file in the process?  I really appreciate if some one could let me know.
    Thanks
    Vish

    As GerdW said, it is preferable (and better practice) to use the project explorer. My guess, you didn't configure the build correctly (and probably used the default settings).
    First, you have to specify your xml file as Always included is the source file tab
    Now look at how the build folders are built:
    The .ini file (xml in your case) is in the data folder. So in the build the relative position of the xml file is not the same as in the development environment. You have to be aware of this difference and use a diiferent relative path for the exe. You can do this using a conditional disable symbol in the project and then use the conditional disable structure in your VI.
    Here in the deploy case the exe will look for the file in the data folder and in the development environment it will look in a folder name Files.
    Ben64

Maybe you are looking for