Can someonr help me with this.. PLEASE

Hi to all
I have an xml Question .
I find that if the nodes are not all filled in then i get the error
java.lang.NullPointerException
If all the nodes are filled in it runs fine. Why is this ? Am I missing somthing
Please if you can explane to what I am doing wrong
Thanks
Craig
this is the code to save.
void SavejButton_actionPerformed(ActionEvent e) {
xmlDoc = new XMLDoc("EPOD_USER");
try
Node userConfig = xmlDoc.addNode(xmlDoc.getRootNode(),"USER_CONFIGURATION");
//Compant Infomation
Node company =xmlDoc.addNode(userConfig,"COMPANY_INFOMATION");
xmlDoc.addNode(company,"COMPANY_NAME", SetupCompanyNameJText.getText());
xmlDoc.addNode(company,"COMPANY_TYPE", (String) CompanyTypejComboBox.getSelectedItem());
//Company Phones
Node contact = xmlDoc.addNode(userConfig,"COMPANY_PHONES");
xmlDoc.addNode(contact,"PHONE_1", SetupPhWork1jText.getText());
xmlDoc.addNode(contact,"PHONE_2", SetupPhWork2JText.getText());
xmlDoc.addNode(contact,"FAX", FaxjTextField.getText());
xmlDoc.saveToFile("EPOD" +".xml");
catch (IllegalNodeAddException inae)
System.out.println(inae.getMessage());
System.out.println(xmlDoc);
// System.out.println(xmlDoc);
cancel();
Code to bring it back .
public void setUserConfig(){
xmlDoc = new XMLDoc();
xmlDoc.loadFromFile("Epod.xml");
try
Node company = xmlDoc.getNode("/EPOD_USER/USER_CONFIGURATION/COMPANY_INFOMATION/");
SetupCompanyNameJText.setText(xmlDoc.getValueOf(company,"COMPANY_NAME"));
CompanyTypejComboBox.setSelectedItem(xmlDoc.getValueOf(company,"COMPANY_TYPE"));
Node phone = xmlDoc.getNode("/EPOD_USER/USER_CONFIGURATION/COMPANY_PHONES/");
SetupPhWork1jText.setText(xmlDoc.getValueOf(phone,"PHONE_1"));
SetupPhWork2JText.setText(xmlDoc.getValueOf(phone,"PHONE_2"));
FaxjTextField.setText(xmlDoc.getValueOf(phone,"FAX"));
catch ( NodeNotFoundException nnfe)
System.out.println(nnfe.getMessage());
}

well, if this SetupPhWork1jText.getText() is null, then you try adding a null node and it explodes...

Similar Messages

  • TS3276 I am not able to Mobile Me email account to connect with iCloud or my Apple Mail program. Don't know if my settings are correct or not. Can anyone help me with this please?

    I am not able to Mobile Me email account to connect with iCloud or my Apple Mail program. Don't know if my settings are correct or not. Can anyone help me with this please?

    http://support.apple.com/kb/HT5922
    If you want to mirror your desktop, see:
    http://support.apple.com/kb/HT5404
    Regards.

  • I have a brand new MacBookProo and I can not open PDF files from my desktop. Can anyone help me with this please?

    I have a brand new MacBookProo and I can not open PDF files from my desktop. Can anyone help me with this please?

    A new Mac comes with 90 days of free tech support from AppleCare.
    AppleCare: 1-800-275-2273

  • Suddenly my music videos won't play on my iPad. I just get the audio? Can anyone help me with this please?

    SUddenly my music videos won't play on my ipad1. I just get the audio. Can anyone help with this please?

    Look in the Videos App and play them in there.

  • HT1491 I've always used itune cards for purchases but i would like to use my credit card now and i can't find where to enter my credit information. can anyone help me with this please

    I've always used itune cards but now I would like to put my credit card info in itunes and can not figure out how to do it can anyone help me please

    If you tap on your account id in Settings > iTunes & App Stores you should be able to view your account info (after you've typed in your password) and you should get a payment details option. Or you can do it via the Store > View My Apple ID drop-down menu option on your computer's iTunes

  • Can anyone help me with this please?

    Modify the FileTokenTester program from the lecture to reverse the tokens in each input string line and output the reversed version to a file,
    apple banana orange strawberry?
    becomes
    strawberry orange banana apple?
    This is all l can do?
    class FileTokenTester
    public static void main (String args[] )
    String inline;
    StringTokenizer st;
    // file handling is enclosed in a try-catch block as methods called
    // may throw exceptions.
    try
    // set up a Reader on the input file
    FileInputStream fis = new FileInputStream("c:\\temp\\inputToken.txt");
    InputStreamReader isr = new InputStreamReader(fis);
    BufferedReader bf = new BufferedReader(isr);
    // set up a Writer on the output file
    FileOutputStream os = new FileOutputStream("c:\\temp\\output.txt");
    PrintWriter pw = new PrintWriter(os);
    // read the first line of input
    inline = bf.readLine();
    // loop until there is no more input
    while (inline != null)
              st = new StringTokenizer(inline );
              while (st.hasMoreTokens())
                   pw.println(st.nextToken());
              inline = bf.readLine();
         pw.close(); // have to close the output stream to flush the buffer
    // and commit the output.
    catch (Exception e)
         System.out.println("Caught Exception: " + e.getMessage()) ;
    }

    1) Please use code tags. Reinsert your original code, so that the tab spaces remain the same.
    2) homework isn't so popular in this forum.
    3) If you have any problems, reduce it to the relevant code and post the error message.
    4) what is your question, anyway?

  • My Apple Loops are not selectable. Can anyone help me with this please?

    Whenever I open up my Apple Loops on Logic Pro X, they are not selectable.
    I have tried reinstalling the program and reinstalling the loops, but that did not work.
    Any help would be much appreciated. Thanks!

    What do you mean.. nothing happened?
    Make sure you followed the instructions exactly.....
    From the Apple () menu, choose System Preferences.
    Click Spotlight.
    Click the Privacy tab.
    Drag a folder or an entire volume (your hard drive) to the list.
    If prompted for confirmation, click OK.
    Remove the item or volume you just added to the list by clicking it and then clicking the minus ("-") button.
    Close Spotlight preferences.
    Spotlight will re-index the contents of the folder or volume.

  • Can anybody help me with this please?

    Since an update my iPhone 4 won't send or receive pictures nor multi text. I've tried several steps & still nothing

    Do you have a data plan on your iPhone 4? Have you checked your settings to ensure MMS is still turned on?

  • My ipod nano 3 generation keep turn in and off even the hold botton is in on possicion can anyone help me with this ?

    my ipod nano 3 generation keep turn in and off even when the hold botton is in on possicion can anyone help me with this please?

    iPod Manuals

  • I urgently need a contact email for the sales team can anybody help me with this

    I urgently need a contact email for the sales team regarding an outstanding query, can anybody help me with this please? Thanks in advance.

    Hello 
    Welcome to the EE Community! I'm afraid there isn't an e-mail you can contact the EE Mobile Sales team on, but here's how you can get in touch with them:
    If you're on Twitter, you can tweet them @EE, however If you'd prefer to talk to someone, you can dial:
    150 from your EE mobile phone
    If you're ringing from another phone, it's 01707 315000
    For handy text codes & more, check out this page: http://ee.co.uk/help/get-in-touch Cheers,
    Titanium
    Was my post helpful? Please take 2 seconds to hit the 'Kudos' button below

  • "It is formatted incorrectly, or is not a format that iBooks can open". Can anyone help me with this message of a book that I purchased on iBooks, read, highlighted in the book and now I can't open it anymore. Please help!!!

    "It is formatted incorrectly, or is not a format that iBooks can open". Can anyone help me with this message of a book that I purchased on iBooks, read, highlighted in the book and now I can't open it anymore. Please help!!!

    Mine does the same thing occasionally, is your phone jailbroken? Sometimes it will work if you delete the book and reinstall it or put your phone into airplane mode then turn it back off.

  • When typing the name of the contact I want to send a text message to, names from my contact list no longer pop up as suggestions. Can anyone help me with this?

    When typing the name of the contact I want to send a text message to, names from my contact list no longer pop up as suggestions. Can anyone help me with this?

        There's always a way to reset the device jmn33! Thanks for keeping us in the loop. To process a full reset/restore on the device please visit http://vz.to/12TLCsR. Please keep us posted once this is completed, thanks!
    MatthewS_VZW
    Follow us on Twitter @VZWSUPPORT

  • HT2801 I understand there is a way to use my Super Drive with my PC.  However, it requires a System OS Disk.  Which I never received.  Can you help me with this?

    I understand there is a way to use my Super Drive with my PC.  However, it requires a System OS Disk.  Which I never received.  Can you help me with this?

    Rick6812 wrote:
      I'm using Windows 8.1. 
    I do not know what you mean by a Windows 8.1.  Please clarify.
    The Apple superdrive is designed to be used with the following Macs.
    It will not work with any other Mac unless you perform this modification;
    http://www.tuaw.com/2012/04/02/use-the-macbook-air-superdrive-with-any-almost-ma c/
    Are you trying to get it to work with a PC? 
    Ciao.

  • I have a problem with my blackberry 9360, I bought it last 2months, and now when I use video camera or camera I saw a red and blue line. Can someone help me with this issue?

    I have a problem with my blackberry 9360, I bought it last 2months, and now when I use video camera or camera I saw a red and blue line. Can someone help me with this issue?

    Hello zukafu, 
    Welcome to the forums. 
    In this case we can try to reload the software on the BlackBerry® smartphone to make sure it is running the latest version and there are no issues with the OS.
    Here is how to backup your BlackBerry smartphone http://bbry.lv/oPVWXc
    Once you have backed up your BlackBerry smartphone please follow the link below to complete a clean reload of the BlackBerry smartphone software.
    Link: http://www.blackberry.com/btsc/KB03621
    Once completed test it and proceed with a selective restore, here is how to restore http://bbry.lv/qgQxLo
    Thank you
    -SR
    Come follow your BlackBerry Technical Team on twitter! @BlackBerryHelp
    Be sure to click Kudos! for those who have helped you.Click Solution? for posts that have solved your issue(s)!

  • I can't sign into iTunes on this pc so I can authorize it. I wan't to do this so I can transfer purchased iTunes music on my iPad mini to this pc. When I try to do this the response I get is just to try again later. Can anybody help me with this?

    I can't seem to sign into iTunes on this pc so that I can authorize it. I want to do this so I can transfer purchased iTunes music on my iPad mini to this pc. The response I keep getting is to try again later but its been days so I don't think that is the problem. I know I am using the correct user name and password so I don't know what's wrong. Can anybody help me with this?

    Hello
    It seems as though your account has been hacked.
    please contact Skype customer service and change your password.
    TIME ZONE - US EASTERN. LOCATION - PHILADELPHIA, PA, USA.
    I recommend that you always run the latest Skype version: Windows & Mac
    If my advice helped to fix your issue please mark it as a solution to help others.
    Please note that I generally don't respond to unsolicited Private Messages. Thank you.

Maybe you are looking for

  • Lightroom 2.1: Smooth ride!

    This program is really getting where no one has been before in terms of functionality, and now also in terms of reliability and operation. I was skeptic about the N.0 version and waited for N.1. It is good! Every step of the process with V2.1 was smo

  • Every time i try to buy a song it asks me to verify my address and wont accept my billing information even when its correct. What do i do?

    Every time i try to buy a song it asks me to verify my address and wont accept my billing information even when its correct. What do i do?

  • Business transaction Control in status profile.

    Hi Friends, Can anyone please explain me? in tstaus profile we maintain status and then in status we create new entries for Business transaction Control. Please explain me the below maintion each if possible in detail. Change configuration data Compl

  • Duplicate Record Search

    I need help with the SQL Statement below. SELECT DISTINCT RISK_CODE, LOB, COMPANY, STATE, RISK_CODE_DESCR, RISK_CODE_QUESTION_TEXT, EXPECTED_RESULT FROM RISK_CODE WHERE RISK_CODE_QUESTION_TEXT IS NOT NULL AND ASK_INDICATOR = 'Y' AND LOB = 'P1' AND ((

  • Lost data after a phone update?

    Hi all, I have a Nokia N95 and ran an update on my phone- I was careful to back-up all my data using PC Suite before updating. After the update i had gone back to the factory settings and had absolutely none of my data on their at all. So i went back