How to read XML from UNIX file system

Hi,
I have this code with read a xml file from windows:
Document doc = builder.build(new File(C:\\mywork\\src\\Contacts.xml));
But how can I read the same file from UNIX? (The file is located in "\tmp\Contacts.xml")
Thanks
Kenny

Hi,
I have this code with read a xml file from windows:
Document doc = builder.build(new
File(C:\\mywork\\src\\Contacts.xml));
But how can I read the same file from UNIX? (The file
is located in "\tmp\Contacts.xml")
Thanks
KennyNo, the file is really located in "/tmp/Contacts.xml". You would writeDocument doc = builder.build(new File("/tmp/Contacts.xml"));Also, your original code would need quotes around the filename too.

Similar Messages

  • How to read HyperLinks from pdf file??

    hi developer's,
    I am in PDF processing... I am having doubt in that Processing.
    How to read Hyperlinks from PDF file?
    I can able to set the hyperlink.. But i cant able to get the hyperlinks..
    The following example program will set the hyperlink to the PDF file using lowagie API..
    import com.lowagie.text.Anchor;
    import com.lowagie.text.Chunk;
    import com.lowagie.text.Document;
    import com.lowagie.text.DocumentException;
    import com.lowagie.text.Paragraph;
    import com.lowagie.text.html.HtmlWriter;
    import com.lowagie.text.pdf.PdfReader;
    import com.lowagie.text.pdf.PdfWriter;
    public class Argu1 {
         public static void main(String[] args) {
              Document document = new Document();
              try {
                   PdfWriter pdf = PdfWriter.getInstance(document,
                             new FileOutputStream("PageLink.pdf"));
    PdfReader pdf_read=new                
                   document.open();
                   document.add(new Paragraph("Hi Everbody....!"));
                   Anchor pdfRef = new Anchor("Click Me");
                   pdfRef.setReference("www.java2s.com");
                   Anchor rtfRef = new Anchor("Touch Me");
                   rtfRef.setReference("www.sun.com");
                   System.out.println(rtfRef.reference());
                   document.add(pdfRef);
                   document.add(Chunk.NEWLINE);
                   document.add(rtfRef);
              } catch (DocumentException de) {
                   System.err.println(de.getMessage());
              } catch (IOException ioe) {
                   System.err.println(ioe.getMessage());
              document.close();
    Help me how to read the Hyperlinks from the PDF file using java ...
    Thanks in advance,
    With Regards,
    J.Imran

    Instead of cross-posting unformatted code you could have taken a look at the API, because there you might have come across a method named getLinks...Even though it's not documented, I really suspect that it will return the Hyperlinks on a given page.

  • Reading Data from Unix file and write into an Internal table

    Dear all,
                     I am having an requirement of reading data from unix file and write the same into an internal table..how to do that ...experts please help me in this regard.

    Hi,
    do like this
    PARAMETERS: p_unix LIKE rlgrap-filename OBLIGATORY.
    DATA: v_buffer(2047) TYPE c.
    DATA: BEGIN OF i_buffer OCCURS 0,
            line(2047) TYPE c,
    END OF i_buffer.
    * Open the unix file..
    OPEN DATASET p_unix FOR INPUT IN TEXT MODE.
    <b>IF sy-subrc NE 0.
    *** Error Message "Unable to open file.
    ELSE.</b>
       DO.
         CLEAR: v_buffer.
         READ DATASET p_unix INTO v_buffer.
         IF sy-subrc NE 0.
            EXIT.
         ENDIF.
         MOVE v_buffer TO i_buffer.
         APPEND i_buffer.
      ENDDO.
    ENDIF.
    CLOSE DATASET p_unix.
    <b>Reward points if it helps,</b>
    Satish

  • How to read data from a file that was formatted by excel?

    Hi everyone, I'm familiar with java.io and the ability to read from files, can anyone tell me how to read data from a file that was formatted by excel? Or at least give me some web references so that I can learn about it?

    http://jakarta.apache.org/poi/hssf/index.html
    HSSF stands for Horrible Spreadsheet Format, but it still works!

  • How to read data from a file in OSB

    hi guys,
    Recently, I've got a problem with reading file from specific location. I've actually followed this post OSB 11g - Read or Poll File in OSB - Oracle Fusion Middleware Blog, and then
    I know how to read a file. However, it does not as expected. Because, I've found no way to read data from the file. Therefore, no chance to manipulate the data like assigning to a variable, or extracting ....
    Hence, is there any way to read data from file by using proxy service in OSB ??? No Java code ???
    by the way, supposed that there is no way to read data from a file in OSB. So, What purposes will the way in the post above be used for?
    Many thanks in advance

    http://jakarta.apache.org/poi/hssf/index.html
    HSSF stands for Horrible Spreadsheet Format, but it still works!

  • How to Read data From Excel File in Labview 8.5?

    We can read it from xls file, but it is encrypted..... we need exact data...

    i have attached that excel file...i want to extract the full data from that file..how i can read it...when i read by using "Read from spreadsheet file" function, data was in encrypted form....so please send me the correct way...
    Attachments:
    stn_auto.xls ‏40 KB

  • Strategy and Process on how to best enqueue from the file system

    I have a single database that must accept BFILES from one location via a directory folder, http text documents via proxy server, and unstructured XMLTYPE CLOB from another database.
    I have created an ANYDATA queue, and will try to transform the dequeued output to XMLTYPE payloads for a pl/sql callback.
    My problem is how to monitor both the file system BFILE folder, and the XMLTYPE CLOBS, to automatically begin then enqueue process. The queue would have to accept from (1) to anynumber of files, and given that requirement the use of an array batch is what I would like to use, but need to populate the array.
    Any help would be most appreciated.
    David

    Thank you for the quick reply.
    The database version is 10.2.0.3.
    There are three sources of documents coming into the system.
    Source 1: Outside entity (in-front of a secure firewall) who must place their XML (XSD compliant) files on a shared file system server (the BFILES).
    Source 2: Internal entity (behind firewall) who publishes their XML files to a defined database directory on the database server.
    Source 3: Enterprise Intranet contributors submitting their individual files via url.
    On entry for each file they must be validated for XSD compliance then if passed submitted to the main enqueue for propagation to 5 additional process queues with separate callback procedures.
    If reasonably possible, separate agents of some sort would "listen" at each folder location, then begin the enqueue process when either a batch of files or a single file is placed in the directory folder.
    AQ itself has no such mechanism to monitor locations, and a scheduled job makes sense - however the job would have to continuously run given the very short processing requirement. However, using DBMS_SCHEDULER may be the best solution given ALL rhe requirements.
    Thank you for your professionalism - I appreciate the assistance.

  • How to read data from a file from a remote area

    Hi,
    i have a jsp page, now i need to read & write data from the file, When i run my program then i give the file path is: "c://sample.txt" if user access this page from remote area to read & write data then what will be the file path? Is there anyone who can solve this problem? What will be the solution of this problem? Please help me.
    With regards
    Bina

    FileReader fr = new FileReader("\\\\pcName\\pcName-Share\\web.xml");
    System.out.println(fr.read());
    fr.close();

  • How to read a client's File system

    Hi,
    I use a web application where in the client can upload a directory to the server. Then the server should display all the files under that directory by fetching details from the client's disk.
    how should this b done with java? Java file system does not allow this. If contents of a single file needs to be read, then it can be sent as multipart form data.
    How to read or find out the files under a directory on the client machine?
    Thnx in advance

    It can be done using the File class used in Java. It can list out directories .
    Several methods are available for inspecting an instance of the File class. Some of the important ones are:
    Method                                                                                             Purpose
    boolean exists()                                   does the file exist?
    boolean isFile()                                    is it a file?
    boolean isDirectory()                            � or a directory?
    String[] list()                                       return the names of all files and directories in a directory
    String getName()                                get the file or directory's name
    String getPath()                                  get the file or directory's path
    These methods are actually all we need in order to find all files and directories in a given directory--all the way down to the last leaves in the directory tree.

  • HELP!!!!   How to read data from a file at time to time?

    i store temporary string data in a file(the data changes always), and i need to read the data in the file from time to time, so how can i read from the file like every 5 seconds?

    Please i need your help mr. noahw. i have a timer called timer1 inside that timer i am starting a thread to read the data in a file to me, then i have another timer timer 2 in which it takes the data already read from timer 1 and draws them on a GUI. the problem with me is that, i am unable to set a correct time for each of the two timers such that, every time timer one executes that is a new data is generated i need to draw only one figure coreesponding to those data, then when a new set of data is read i need to draw another figure based on the new data read, please help me with this becasue i need it urgently, this is my email, [email protected], and i can offer this reply as many points as you want if this helps you to help me, i am counting on you.

  • How to read data from a file

    I have a file that looks like this with out the *'s
    lastName firstName number
    lastName firstName number2
    lastName firstName number3
    lastname = (string) an actual last name like smith same for first name
    number = an actual number (int) like 90 or 120
    I need to read the number from this file and store it in an array. I have some code that I started, but im not sure what to do next. Please help!
    //int searchId;
         int fileData;
         vector <int> employeeIds;
         //cout<<"Enter Employee ID: ";
         //cin>>searchId;
         ifstream dataFile("Small-Database.txt");
         dataFile >> fileData;
         while(!dataFile.eof())
               //this is where i need help, how can i read in a number. i tried using the getLine() function but it did not help
              //employeeIds.push_back(fileData);
              //dataFile >> fileData;
         dataFile.close();Thank you for any help in advance

    The >> operator reads a value corresponding to the target type. For example, to read an integer value, read it into an int variable (or long or long long, depending on the integer range).
    The >> operator skips white space (blanks, tabs, newlines) and then reads characters corresponding to the target type: digits for an integer value, for example. It stops at the first character that cannot be in the representation of the type. If no characters are read, the stream goes into an error state, and further I/O requests are ignored until you clear the stream state.
    You can read each group of data like this:
    std::string first, last;
    int number;
    dataFile >> first >> last >> number;If the data doesn't have the right characteristics, the stream will go into an error state, which you can detect by testing the stream directly:
    if( dataFile ) ...Using EOF as the loop control is not a good idea, since if there is an error, the loop will never terminate. You can do something like this:
    while( dataFile ) {
        std::string first, last;
        int number;
        dataFile >> first >> last >> number;
        if( dataFile ) {
            // ... add first, last, number to the data structure
    } Reading past EOF puts the stream in an error state, so checking the stream state before saving the data and in the loop control will do the trick.
    You can use a char array instead of a string for the names, but then you have to add extra testing to be sure you don't overflow the array, and deal with the extra characters you don't read. Strings will expand as needed. The string is declared as a local variable in the loop, so it gets re-initialized each time through; you don't need to write code to reset it.
    My example loop is not robust in the face of errors. Stream I/O works fine when you know the input data is well-formed. It is not suited to input that can be wrong, such as data typed from the terminal, because it is not easy to validate the input and recover from errors.

  • How to read data from txt file respectively

    Hi,
    I am triying to form an equation between two known points. I want to do this with the attached VI, the most critical point is that I will read the x1, y1, x2 and y2 coordinates from the same .txt file. They will be written in a .txt file and I will send them to the appropriate channel (x1, y1, x2 and y2) respectively. How can I get data in a rule from a .txt file?
    Could anyone please help me with this issue,
    Best regards. 
    Attachments:
    read from txt file.vi ‏8 KB

    Dear RavensFan,
    Thank you very much for your helps, I am bit new to labview so I usually can not find the appropriate functions easily. And a new problem has rised in my application. I should write the A, B and C numbers in the respective series to the file 2.txt. I am able to write them in a straight forward case but I want to write the next triples (A B C) in the next row. Like this;
    A1 B1 C1
    A2 B2 C2
    A3 B3 C3
    So how can I put new line constant and space constant to my VI? 
    Waiting for your valuable helps,
    Best regards,
    Attachments:
    read_from_txt_fileMOD.vi ‏18 KB

  • How to Read data from excel file without converting a excel file into .csv or any other format

    Hello,
    Can somebody suggest me how to read from an excel file (consisting of 10 work sheets) to an array?
    Thanks,
    She

    You have to be careful when using the spreadsheet-files vi's.  They are located in the Functions Palette under File IO, you will find "Write To / Read From Spreadsheet File.vi"s. 
    Here is what the Context Help says about the vi function:
    "Reads a specified number of lines or rows from a numeric text file beginning at a specified character offset and converts the data to a 2D, single-precision array of numbers. You optionally can transpose the array. The VI opens the file before reading from it and closes it afterwards. You can use this VI to read a spreadsheet file saved in text format. This VI calls the Spreadsheet String to Array function to convert the data. "
    This is quick & easy when the spreadsheet is all the same format.  You can set the format to string as well.  HOWEVER...  you do have to convert the Excel spreadsheet to text before using it.
    I haven't experimented with the Active-X, but it may look as the way to go if you have combination text / numeric values in the spreadsheet.
    If you did convert it to text, then you can use array functions as well and treating the file as an array of strings (see very brief example attached).  The example is to illustrate a point only  
    JLV
    Attachments:
    starting point for spreadsheet.vi ‏28 KB

  • How to read bits from the file?

    Hello everybody,
    I'm beginner in LabVIEW. I need to get bits from the file, but I don't know how I can do it. I use the example "Read Binary File VI" from LabVIEW Help, but it returns DBL array. And for a long time I can't find a solution to convert this array to array of bits.   Can somebody help me? Thanks in advance. 
    Solved!
    Go to Solution.

    tranonim wrote:
    Hello everybody,
    I'm beginner in LabVIEW. I need to get bits from the file, but I don't know how I can do it. I use the example "Read Binary File VI" from LabVIEW Help, but it returns DBL array. And for a long time I can't find a solution to convert this array to array of bits.   Can somebody help me? Thanks in advance. 
    You can pass in the type into the Read Binary File VI to get the data in whatever form you want.  Just remember that a boolean is really 8 bits.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How to read data from a file that is already open by another program

    Hey..
    I have made IV, where I'm trying to read data from a log file, that is being updated by another program while my IV runs.
    To be clear, this program writes data continuously to this file and I want to read from the file in LV at the same time.
    The problem is that LV reports an error when I'm trying to read the log file, even if I use to "read only" mode.
    I believe that the program that is producing the file, have some kind of lock on the file. I have tryed to copy the file and then reading from the copied file, but LV throws already an error when I try to copy the file.
    Has anyone tryed this, and found a solution.?
    Additional info: The program that produces the file is STM Studio 
    Best Regards
    Allan

    Hi Alha,
    when that file is locked by the other program you can't do anything about that - apart from quitting that other program. Probably this isn't an option to you…
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

Maybe you are looking for

  • Cannot ping windows 2008 r2 while it is possible for another machine in the same network

    Hi, Recently I have set up a new server with windows 2008 r2 enterprise OS which is a domain member server.  At network layer I have two networks one with 192.168.1.0/22 and another with 10.0.0.0/24 network IDs. My problem is that I cannot ping the n

  • Pdf in a window inside another pdf?

    Hello, Im comfortable using the multimedia tool and like the way it works inside a pdf. So does anyone know how to make it so that inside one pdf there would be a window that prewievs another (attached or linked) pdf in a certain area? So just like l

  • How to validate ch field in selection screen

    hi experts....... how to validate ch field selection screen......... and which function module is used to validate parameter field i.e character

  • IMovie 11: Is it possible to layer effects in "clip inspector" menu?

    I want to do a side-by-side video with one side flipped in the "clip effects" so it looks like the halves are going into each other. Question: since I have already used 'flipped' for the left section, can I use another effect for the left section? I

  • Installing the sdk

    could somebody help me setting up the path to the sdk since the command prompt would not accept the sdk as such please specify the names that would be suited for the instllation cheers