How do i use Java to read the data in XML files?

Hi,
I'm rather interested in using XML in my javacodes, as i think it will be of more OO.
I want to make use of XML in my javacodes,
but i don't know how to start doing it, so i hope someone would be able to enlighten me on this,
=)
Some examples would be perfect

Humm interesting...well here is the link to Sun's tutorial on how to use maipulate an XML document using Java's jaxp api.I hope this will give u a hint.
http://java.sun.com/xml/tutorial_intro.html
Khalid

Similar Messages

  • How to process other task when reading the data from a file?

    Hello,
    I met a problem. I created a GUI to control the audio data processing. When the "Start" button is pressed, a block of data is read from the audio file and processed, then loop.But other buttons or method cannot be operated in that procession until all data is processed.
    How to let the other methods work under that circumstance? Should I use multiple threads?
    The relative code:
    SourceDataLine line;
    boolean stop = false;
    // When press "Start" button, the following method is invoked:
    public void play(){
    line.start();
    int bytesRead = 0;
    byte[] dataBuf = new byte[7500];
    while (bytesRead != -1& !stop)
    try
    bytesRead = audioInputStream.read(dataBuf, 0, dataBuf.length);
    catch (IOException e)
    e.printStackTrace();
    if (bytesRead >= 0)
    int bytesWritten = line.write(dataBuf, 0, bytesRead);
    line.drain();
    // When press "stop" button, this method is invoked.
    public void stop(){
    stop = true;
    line.stop();
    // When press "***" button, the following button is invoked:
    public void ***(){
    Many thanks.Looking forward to getting your answer.

    You have to use a seperate thread :
    Wheb you press the start button, you have to make sure a seperate thread is started :
    Thread runner = new Thread(){
    public void run(){
    //Here comes your code which reads the file
    runner.start();
    KR,
    Jan

  • How to read the data from XML file and insert into oracle DB

    Hi All,
    I have below require ment.
    I will receive data in the XML file. then i need to read that data and insert into oracle tables. please let me know how this can be handled.
    Many Thanks.

    Sounds a lot like this question, only with less details.
    how to read data from XML  variable and insert into table variable
    We can only help if you provide us details to help as we cannot see what you are doing and only know what you tell us.  Plenty of examples abound on the forums that cover the topics you seek as well.

  • How to read the data from Excel file and Store in XML file using java

    Hi All,
    I got a problem with Excel file.
    My problem is how to read the data from Excel file and Store in XML file using java excel api.
    For getting the data from Excel file what are all the steps i need to follow to get the correct result.
    Any body can send me the code (with java code ,Excel sheet) to this mail id : [email protected]
    Thanks & Regards,
    Sreenu,
    [email protected],
    india,

    If you want someone to do your work, please have the courtesy to provide payment.
    http://www.rentacoder.com

  • How to read the contents of XML file from my java code

    All,
    I created an rtf report for one of my EBS reports. Now I want to email this report to several people. Using Tim's blog I implemented the email part. I am sending emails to myself based on the USERID logic.
    However I want to email to different people other then me. My email addresses are in the XML file.
    From the java program which sends the email, how can I read the fields from XML file. If any one has done this, Please point me to the right examples.
    Please let me know if there are any exmaples/BLOG's which explain how to do this(basically read the contents of XML file in the Java program).
    Thank You,
    Padma

    Ike,
    Do you have a sample. I am searched so much in this forum for samples. I looked on SAX Parser. I did not find any samples.
    Please help me.
    Thank you for your posting.
    Padma.

  • How to read the data from a file in another computer with user name and password login

    How to read read the data from a file in anohter computer which need to login with user name and password?

    duplicate post:  http://forums.ni.com/t5/LabVIEW/log-on-the-other-computer-with-user-name-and-password/m-p/2061478
    duplicate post:  http://forums.ni.com/t5/LabVIEW/do-need-to-enter-the-user-name-and-password-when-TCP-ip/m-p/2061612
    duplicate post   http://forums.ni.com/t5/LabVIEW/log-on-the-other-computer-with-user-name-and-password/m-p/2060682

  • I use LabVIEW 7.1 but I have some problem when, I use LabVEW to read the data from serial communication

    I use LabVIEW 7.1 but I have some problem when, I use LabVEW to read the data from serial communication.
    I use LabVIEW to read the data from serial communication then, i open the example (.vi) from Serial Communication - Advanced Serial Write and Read  from LabVIEW Example. BUT it have some error message that : Error - 1073807202 occured  at property node in visa configure serial port (instr).vi -> advance serial write and read .vi
    this error code is undefined. no one has provide a description for this code, or you might have wired a number that is not an error code to the error code input.
    I don't know why? please help me. thank you.

    When I copy that code into "Explain Error" I get: "VISA:  (Hex 0xBFFF009E) A code library required by VISA could not be located or loaded."
    You may have a bad install of VISA or the wrong version of VISA loaded. Try re-installing VISA. You can get the latest version from the NI support site: http://digital.ni.com/softlib.nsf/webcategories/85256410006C055586256BBB002C0E91?opendocument&node=1....
    Also ensure that you are not pointing the example towards a serial port that does not exist.
    Please let us know what you find and what gets this working for you.
         Rob

  • Reading the data from XML Source

    Hi
    i want to read the data from XML source file, and update the transaction information to another XML file. how we can do this in ADF, please help
    Thanks
    nidhi

    you may use normal Java API to do that
    http://www.javablogging.com/read-and-write-xml/

  • Use LINQ to extract the data from a file...

    Hi,
    I have created a Subprocedure CreateEventList
    which populates an EventsComboBox
    with a current day's events (if any).
    I need to store the events in a generic List communityEvents
    which is a collection of
    communityEvent
    objects. This List needs to be created and assigned to the instance variable
    communityEvents.
    This method should call helper method ExtractData
    which will use LINQ to extract the data from my file.
    The specified day is the date selected on the calendar control. This method will be called from the CreateEventList.
    This method should clear all data from List communityEvents.  
    A LINQ
    query that creates CommunityEvent
    objects should select the events scheduled for selected
    day from the file. The selected events should be added to List
    communityEvents.
    See code below.
    Thanks,
    public class CommunityEvent
    private int day;
    public int Day
    get
    return day;
    set
    day = value;
    private string time;
    public string Time
    get
    return time;
    set
    time = value;
    private decimal price;
    public decimal Price
    get
    return price;
    set
    price = value;
    private string name;
    public string Name
    get
    return name;
    set
    name = value;
    private string description;
    public string Description
    get
    return description;
    set
    description = value;
    private void eventComboBox_SelectedIndexChanged(object sender, EventArgs e)
    if (eventComboBox.SelectedIndex == 0)
    descriptionTextBox.Text = "2.30PM. Price 12.50. Take part in creating various types of Arts & Crafts at this fair.";
    if (eventComboBox.SelectedIndex == 1)
    descriptionTextBox.Text = "4.30PM. Price 00.00. Take part in cleaning the local Park.";
    if (eventComboBox.SelectedIndex == 2)
    descriptionTextBox.Text = "1.30PM. Price 10.00. Take part in selling goods.";
    if (eventComboBox.SelectedIndex == 3)
    descriptionTextBox.Text = "12.30PM. Price 10.00. Take part in a game of rounders in the local Park.";
    if (eventComboBox.SelectedIndex == 4)
    descriptionTextBox.Text = "11.30PM. Price 15.00. Take part in an Egg & Spoon Race in the local Park";
    if (eventComboBox.SelectedIndex == 5)
    descriptionTextBox.Text = "No Events today.";

    Any help here would be great.
    Look, you have to make the file a XML file type -- Somefilename.xml.
    http://www.xmlfiles.com/xml/xml_intro.asp
    You can use NotePad XML to make the XML and save the text file.
    http://support.microsoft.com/kb/296560
    Or you can just use Notepad (standard), if you know the basics of how to create XML, which is just text data that can created and saved in a text file, which, represents data.
    http://www.codeproject.com/Tips/522456/Reading-XML-using-LINQ
    You can do a (select new CommunityEvent) just like the example is doing a
    select new FileToWatch and load the XML data into the CommunityEvent properties.
    So you need to learn how to make a manual XML textfile with XML data in it, and you need to learn how to use LINQ to read the XML. Linq is not going to work against some  flat text file you created. There are plenty of examples out on Bing and Google
    on how to use Linq-2-XML.
    http://en.wikipedia.org/wiki/Language_Integrated_Query
    <copied>
    LINQ extends the language by the addition of query
    expressions, which are akin to
    SQL statements, and can be used to conveniently extract and process data from
    arrays, enumerable
    classes, XML documents,
    relational databases, and third-party data sources. Other uses, which utilize query expressions as a general framework for readably composing arbitrary computations, include the construction of event handlers<sup class="reference" id="cite_ref-reactive_2-0">[2]</sup>
    or
    monadic parsers.<sup class="reference" id="cite_ref-parscomb_3-0">[3]</sup>
    <end>
    <sup class="reference" id="cite_ref-parscomb_3-0"></sup>

  • Reading the data from excel file which is in application server.

    Hi,
    Iam trying to read the data from excel file which is in application server.
    I tried using the function module ALSM_EXCEL_TO_INTERNAL_TABLE. But it didn't work.
    I tried just reading using open data set and read data set it is giving junk characters.
    Please suggest me if you have any solution.
    Best Regards,
    Brahma Reddy

    Hi Narendra,
    Please see the below code I have written
    OPEN DATASET pa_sfile for INPUT in text mode ENCODING  DEFAULT MESSAGE wf_mess.
    CHECK sy-subrc = 0.
    DO.
    READ DATASET pa_sfile INTO wf_string.
    IF sy-subrc <> 0.
    EXIT.
    else.
    split wf_string at wl_# into wf_field1 wf_field2 wa_upload-field3
    wa_upload-field4 wa_upload-field5 wa_upload-field6 wa_upload-field7 wa_upload-field8
    wa_upload-field9 wa_upload-field10 wa_upload-field11 wa_upload-field12 wa_upload-field13
    wa_upload-field14 wa_upload-field15 wa_upload-field16 wa_upload-field17 wa_upload-field18
    wa_upload-field19 wa_upload-field20 wa_upload-field21 wa_upload-field22 wa_upload-field23
    wa_upload-field24 wa_upload-field25 wa_upload-field26 wa_upload-field27 wa_upload-field28
    wa_upload-field29 wa_upload-field30 wa_upload-field31 wa_upload-field32 wa_upload-field33
    wa_upload-field34 wa_upload-field35 wa_upload-field36 .
    wa_upload-field1 = wf_field1.
    wa_upload-field2 = wf_field2.
    append wa_upload to int_upload.
    clear wa_upload.
    ENDIF.
    ENDDO.
    CLOSE DATASET pa_sfile.
    Please note Iam using ECC5.0 and it is not allowing me to declare wl_# as x as in your code.
    Also if Iam using text mode I should use extension encoding etc.( Where as not in your case).
    Please suggest me any other way.
    Thanks for your help,
    Brahma Reddy

  • Dumping the data to XML file (Event driven )

    Hi ,
    Can anybody help me on this requirement .
    Whenever there is an updation or change in the HR Master data like insertion of new personnel number or deletion of personnel number then I need to dump the data to XML file . That means I need to make it event driven.
    Will it be possible programmatically ?
    Please give me your inputs.
    Best Regards
    Bhagat.

    Hi Bhagat,
    isn't it possible to use change pointers for this?
    Then in partner profile use an XML file port and it should be done!
    Probably this blog could help you:
    <a href="/people/stefan.grube/blog/2006/09/18/collecting-idocs-without-using-bpm">Collecting IDocs without using BPM</a>, have a look at the part where it explains how to write Idoc as XML.
    Hope it helps,
    Kind Regards,
    Sergio

  • Downloading the data to XML file (Event driven )

    Hi ,
    Whenever there is any change or updation in HR master data i need to download the data to XML file. I have written a program to download the data to XML file but i need to trigger this program only when there is a change in HR master data.
    Could somebody tell me how to go about this. Reward points are assured.
    Best Regards
    Bhagat.

    Hi Bhagat,
    isn't it possible to use change pointers for this?
    Then in partner profile use an XML file port and it should be done!
    Probably this blog could help you:
    <a href="/people/stefan.grube/blog/2006/09/18/collecting-idocs-without-using-bpm">Collecting IDocs without using BPM</a>, have a look at the part where it explains how to write Idoc as XML.
    Hope it helps,
    Kind Regards,
    Sergio

  • Does JDeveloper deploy the data-sources.xml file?

    Hi,
    My project has a data-sources.xml file. When I deployed the project, JDeveloper created a .war file. The data-sources.xml file is not in the .war file. How will the application server pick up the data source if the xml file is not getting deployed?
    Thanks,
    Merced

    data-sources.xml configures the datasource with the oc4j server.
    A <Application>-data-sources.xml file also gets added for a project to the project directory.

  • How to read the data of  a file using upload option....

    Hi Frndz..
    As per my requirment , i need to provide a upload UI to the user , so he can select file to be upload whenever user select the file n clicks on upload button i need to read the data of that fiel that user selects.
    I have a solutions for this in JSP/JAVA , but i was unable to handle this in web dynpro..c this link in jsp ..
    http://www.roseindia.net/jsp/fileupload.shtml
    Thanks in Advance..
    Regards
    Rajesh

    Hi,
    Create a Value attribute (resource) of type Resource, bind it with the property of File Upload UI element.
    On action place the code and Deploy the application
    byte[] bytes = new byte[ 1024];
    FileOutputStream out = new FileOutputStream( new File( <path in server>));
    InputStream in = resource.read( true);
    int len;
    while( ( len = in.read( bytes)) > 0)
         out.write( bytes, 0, len);
    in.close();
    out.close();
    Regards
         Vinod V

  • Flilter webpart to read the data from XML template

    Hi
    Is there any out of the box webpart to read data from xml file for filtering in sharepoint 2010.
    The filter dialog look like following functionality and allow to select only one value.
      .Paretn1
         chiild1
         child2
     .Parent2
         child1
         child2
    Thanks

    Hi,
    According to your post, my understanding is that you wanted to read data from xml file with the out of the box web part.
    There is no out of the box web part for us to read the data from the xml file in SharePoint 2010.
    However, you can create your own custom web part to achieve it.
    There are some articles about the read the xml file, you can have a look at them.
    http://mosshowto.blogspot.com/2008/10/simplify-xpath-use-c-class.html
    http://social.technet.microsoft.com/Forums/en-US/6ae03f7a-23fe-4361-9e4f-d82bd3802ebf/how-to-read-data-from-an-xml-file-in-sharepoint-2010s?forum=sharepointgeneralprevious
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

Maybe you are looking for

  • Some questions regarding CO-PA

    Hello Experts, I have some questions regarding de COPA module: 1-Where can i find wich G/L accounts are assigned to a especific condition type? Is there any transaction where i can check the g/l accounts for the condition types? 2-I heard that the co

  • Problem exporting photos

    I have a problem with exporting my images from Lightroom 4 to a folder or Photoshop. Please help.

  • Strange output??

    Hello, I am using the SAX parser to parse a xml file which can be downloaded from the http://archive.godatabase.org/latest-termdb/go_daily-termdb.obo-xml.gz. The file is a gene ontology. My problem is that from the 25000 terms described in this file,

  • Reinstalling cs4 upgrade on os10.8.3

    My Company has updated my mac from an older power pc imac to a new imac with Os 10.8.3. I'm trying to load on the applications with I have in boxed form using disks. Oh Oh no disk tray in this new mac. Ive tried using remote disk linked from my older

  • Sheduled jobs on redunant application server environment

    I've been taking a brief look at running sheduled (housekeeping) task in an environment where we have multiple redundant app servers (Oracle, for our sins). These servers are coupled so that deployments propagate automatically. What I was wondering w