Open XML, how to write the path

Hello

I'm new to the Blackberry development and I hope you can help me with my problem. I try to work with an XML file, and so far, all that does very well as long I had the xml file, I work on, in the folder of my java application and deyployed using the desktop software. Now, I tried to put the file somewhere else on the Blackberry and I don't know how wirte the path to the source code. I tried the following, but it seems to be bad:

private static String _xmlFileName = "file:///store/home/user/documents/test.xml";
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            DocumentBuilder builder = factory.newDocumentBuilder();
            InputStream inputStream = getClass().getResourceAsStream( _xmlFileName );
            Document document = builder.parse( inputStream );

I hope you can give me a hint, how I write the correct path?

Thank you very much!

Best regards, jtr87

PS: Sorry for my bad English, but I did not use it very often.

You need to do something like that to get your InputStream:

/** * @return an open InputStream for a file, or null if file does not * exist. * @throws IOException if there is an error opening the file */InputStream getInputStream(String name) throws IOException {
    FileConnection fc = null;
    try {
        fc = (FileConnection) Connector.open(name, Connector.READ);
        if (fc.exists()) {
            return fc.openInputStream();
        }
    } finally {
        if (fc != null) {
            try {
                fc.close();
            } catch (Exception ignored) {
            }
        }
    }
    return null;
}

Notice that you must close the FileConnection at some point, regardless of if the call to openInputStream worked.

Tags: BlackBerry Developers

Similar Questions

  • How to write the script in FDMEE below.

    How to write the script in FDMEE below.

    Script below is the FDM Script.How write in FDMEE.

    If (varValues (14) '113101' =) OR (varValues (14) '113201' =) OR (varValues (14) '113301' =) OR (varValues (14) = "252111") OR (varValues (14) '156101' =) then

    Result = "21_asd."

    Please help me on this issue.

    Kind regards

    Satheesh, S

    If you want to determine the id of the target account your opening assignment statement must be:

    Account = fdmRow.getString ("ACCOUNTX")

    As if - elif-instructions else keep lowercase stream operators. If you continue a command on multiple lines, then place parentheses is

    If (account == "113101") or (account == "113201") or (account == "113301") or (account == "113401") or (account == "113501") or (account == "113601") or (account == "215101") or (account == "215201") or (account == "215301") or (account == "215401") or (account == "215501") or (account == "215601") or (account == "252111") or (account == "156101"):

    fdmResult = "21_ADNIP".

    should be (also get rid of the unnecessary parentheses)

    If (account is "113101" account is "113201" or account is '113301' account is "113401" or account is "113501" or account is "113601" or account is "215101" or account is "215201" or account is "215301" or account is "215401" or account is "215501" or account is "215601" or account is "252111" or account is "156101"):

    fdmResult = "21_ADNIP".

  • How to write the even-odd fill feature?

    How to write the even-odd fill feature?

    Maybe like this:

    app.executeMenuCommand ('* ');

    01.jpg

    There is a command in the PathItem object named evenodd. I think that if you change the property of evenodd and get a member of a composite path path, you can achieve a desired result.

  • How to write the text file in Shockwave?

    Someone knows how to write the text file in Shockwave on the disc of the user?

    Thanks in advance.

    These Xtras can cause a lot of havoc when used with the intent to hurt.
    What you can do is to write with setpref and store a list of backups and the
    registers itself separately. Next, you need to build your own save/open
    dialog box for the user:
    * Choose a previously saved file to load or replace
    to create a user type the name of a new file to be saved.

    The only thing that remains is that the user can't decide where files
    are saved.

    Manno

    SiuLinda wrote:
    > Thanks a lot for your answer.
    > Yes, cookies is good, but I have to write a program to save the text file in
    > When the user wants, the user can open these files later if they like as, using
    > Filextra and Fileio, but I found that all these Xtra extensions seem to be not supported by
    > shockwave.
    >

    --
    ----------
    Manno Bult
    [email protected]

  • How to set the path of the report in a plugin for model

    I'm trying to figure out how to set the path of the report in a plugin process model. I can't find a way to have access to it. It seems this would be a reasonable thing to do since the plug-ins are for the treatment of the results. Does anyone know how to do this? We generally use the sequential process model, but I try to keep my plug-in as independent as possible.

    Thank you.

    If I understand correctly, you want your plug-in, when enabled, change the settings of all other instances of the report OR plugin as their reports share the same directory that your plug-in is configured to use.

    If so, your plug-in can access and change the settings of all other instances of plugin. All instances are passed to all the points of plugin entries in the subproperty of the plugins of the ModelConfiguration parameter table. You can browse this table. Any element of the array with an equal to "NI_ReportGenerator.seq" Base.SequenceFilename is an instance of the report OR plugin. Its report options are stored in the element under PluginSpecific.Options.

    You can change the report options to what you want. Note that the recall of the ReportOptions model is called from template-plugin Initialize entry point, then you might want to ensure that your changes are applied after that, so they are not replaced. To do this, you could make your changes in the Initialize entry point of your plugin and make sure your plugin runs last. To rotate the last, you can set the FileGlobals.ModelPluginComponentDescription.Default.Base.RunOrder in your file of plug-in with a value greater than 0, for example 1.0 (see Help for TestStand > Fundamentals > process template Architecture > plug-in for the model process Architecture > Structure of the plugin sequence files > plugin model of entry Points > Order Execution of Point of entry at run time).

  • How to find the path of a file

    Hello

    I have Windows 7 Starter.

    The search utility can be used to search for files by using the ' * ' wildcard, but unfortunately it does not show the path for no results.

    I would like to know how to find the path of a file of my choice.

    For example, I record a radio on the internet, which is then saved as "MP3". Now, I want to edit such a file, but I need to know where the file is actually stored. Simply access within a 'library' does not show me where the file is actually located.

    How to discover all paths where a particular file format?

    I hope to receive a response to this request.

    Kind regards

    Rayt333

    An option for the search utility see the paths for all of its results, would be useful.

    Hi Ray

    Overall view for the search folder for Detailsof Windows Explorer , by using the View Menu on the right side of the toolbar.

    Click on the last name column heading and select the folder item.

    If you do not see the folder item, click other, scroll and select the folder item. This will add the folder column.

    Use the left mouse button to drag the folder column to the left, next to the column name .

    Now, when you perform a search, the folder column will show the path of each file found.

    Concerning

  • How to display the path of a contact with a program?

    How to display the path of a contact with a program?

    Hey,.

    Follow the mentioned below as follows:

    1. Go to Contacts > Contacts.
    2. Highlight the contact to which you want to see the way through the program.
    3. Click on the newspaper story > program activity.

    Thank you...

  • How to write the query

    Hello

    How to write the sql query

    I have three type of table as

    1 table emp

    EMP_ID FIRST_NAME DEPT_ID

    ---------- -------------------- ----------

    1 kumar 10

    2 sam                          20

    3 30 damu

    2 table dept

    EMP_ID SALE_ID DEPT_ID

    ---------- ---------- ----------

    1 101 10

    2 102 20

    3 103 30

    3. table sale

    EMP_ID SALE_ID SALE_AMT

    ---------- ---------- ----------

    1 101 7

    2 102 8

    3 103 9

    I want the result as

    EMP_ID DEPT_ID SALE_AMT

    -------      ---------   -            --------

    1                10                  7

    Thank you

    Are you looking for this?

    SELECT T1. EMP_ID,

    T1. DEPT_ID,

    W3M SALE_AMT

    FROM EMP T1,

    SALE T3

    WHERE T1. EMP_ID = T3. EMP_ID;

    OUTPUT:

    EMP_ID DEPT_ID SALE_AMT

    ------- ---------- ----------

    1         10          7

    2         20          8

    3         30          9

    If this is not the case, after the actual output, you need. Because that gives you the amount of sales deptwise

  • How to write the 'C' alpabelt within a circle of author?

    Hello

    How to write the symbol of copyright on first Pro CC (ie the alpabelt 'C' inside a circle) ?

    Thank you

    On a Mac, Option + G.

    MtD

  • How to select the path to a file icon button to a table?

    I have a SYSTEM_PATHS table name. All physical access paths as 'where the forms of execution are located' or 'where performance reports are located' are stored in its ranks for example (C:\HRMS\FORMS\)
    I memorized the path of the icon files (.ico) inside. The forms of execution can take the path of the icons for the buttons of this table. And access the icon of the chosen path. I use forms 6i. Normally, I put the path of the icon files in the nerve to property of the button as (C:\HRMS\ICON\). But now, here, I don't have a path but its in the column of a table. How to select the path to a file icon button to a table using forms 6i?

    Hello Gul,

    have you tried

    set_item_property('Button name',ICON_FILENAME,);
    

    Concerning
    Marcus

  • How to get the path of the vmdk to a VM stop file?

    Hi guys,.

    How to get the path of the vmdk to a VM stop file in ESX Server via the VIX API?

    I try to get it via the VixVM_ReadVariable() function. but it seems that this function requires that the virtual machine is power on.

    I don't want to go the virtual machine started, I just want to know if I can get the path of the vmdk file when a virtual machine is power off.

    Thanks in advance.

    Sorry, I don't have any samples.

    However, if you look at the layoutEx of the managed object VirtualMachine field, you will see that the VirtualMachineFileLayoutEx data object has a field "files" which should contain the paths of affected files.

    I hope that it should be able to help get started.

  • How to write the query option in expdp

    Hi Please someone help me how to write the query option in expdp... .in expdp using the query option...

    where AM columnname between 5 May 12 02:57:00.000' and ' 02:59:59.999 6 May 12: ';


    Please do what is necessary...

    Pavan Kumar says:
    QUERY = (columnname scott.test: "where between 5 May 12 02:57:00.000 h ' and ' 6 May 12 AM 02:59:59.999'")

    Who will fail in databases, because you assume nls_date_format. How it is difficult to put to_date() surround channels? Rather than play with quotation marks, using one parfile thusly.

    query=table_owner.table_1:"where business_date between to_date('20120505025700 am','yyyymmddhhmiss am') and to_date('20120505025959 am','yyyymmddhhmiss am')"
    query=table_owner.table_2:"where business_date between to_date('20120505025700 am','yyyymmddhhmiss am') and to_date('20120505025959 am','yyyymmddhhmiss am')"
    query=table_owner.table_3:"where business_date between to_date('20120505025700 am','yyyymmddhhmiss am') and to_date('20120505025959 am','yyyymmddhhmiss am')"
    

    You do not have to have all the clauses in a single line, as they are side by side parfile, which would be enough. For this reason parfile is better than the command line in order to avoid all the back-citing dance.

  • How to get the path of the directory component in custom filter

    How to get the path of the directory component in a custom filter?
    final String absoluteComponentPath = CompInstallUtils.computeAbsoluteComponentLocation( "yourComponentName" );
    
  • How to get the path or the file name of getChild

    Hey everyone, good day!

    Is - anyone here know how to get the path or the file name of an object inserted into the scene?

    Here's the scenario:

    I am developing a flash application, which allows the user to insert background to the scene to help her browse and select using the FileReference in flash. I inserted some image the user successfully choose, but what I'm trying to make, is that if the user clicks on save, the background image it has chosen will be copied to a different folder on the web (file upload). So I need to know the path and the file name of the background image.

    Here is my AS3 code:

    for (var i: uint = 0; i < container.numChildren; i ++) {}
    trace ('\t|\t' + i +'. \t name:' + container.getChildAt (i) .name + "\t type:" + typeof (container.getChildAt (i)) + "\t" + container.getChildAt (i));
    }

    ------------------------------------------------------------------------------------------ -----

    Here is the message trace of the code above:

    |     0 name: instance120 type: object [object Loader]

    ------------------------------------------------------------------------------------------ --------

    Any help here? I thank in advance.

    The Loader class has a property contentLoaderInfo (an instance of the class LoaderInfo) that contains information, that you are probably after, including the url of the content that has been loaded...

    Loader.contentLoaderInfo.url

  • How to write the select query for it

    Hello

    I had an html form and the area I drop down and he needs to select several values in the drop-down box. When I select multiple values then I have to write the query to SQL select statement.

    When I try to write the select statement and trying to run I get the error message.

    Select * from Table

    where emo_no = '1,2,3 '.

    That's how I write the query please suggest me how to write the query to select several values in the drop-down box.

    Thank you

    Use the keyword sql 'in '.  If you don't know how, I've heard good things about the book Teach Yourself SQL in 10 Minutes by Ben Forta.

Maybe you are looking for