Can anybody help me with this project. I am trying to let this program read from XML file. Data online on this web: http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml. How to make this project pull the information from that web and put it txt file then appear it on the GUI. This what I have done and I still have error. |
I couldn't see it on 166. It just do math when I run it which takes numbers from XML file and then do calculate, but when I just chose currency name from selection it gave me this long error. It shows the code bring all the information from XML file and put it down there but don't give me the convert result on the GUI. |
I am tried to modify my Currency Converter class to connect to this web site and download the requisite data. The data source is in XML format, so my application will have to parse the xml data and store it locally in a file. The HashMap and the ArrayList must then be populated from this local file. Thanks a lot man but the GUI disappeared. and give me this result: |
I know, I bother you too much about my questions and I know you are a good man. Okay but teacher requested if you think that is enough. I will leave it like this. What about the GUI? it does not show up. Thank you. |
In your original code - did GUI show up? I didn't try to run your original code - I just added this piece to populate HashMap1 (and I tested it separately reading from the same file in another program) and removed two lines below where you populated the HashMap1 After that it shouyld execute the same wayn it was execution before when you were populationg HashMap1 from the local file So this chnage should not have affected GUI at all. If that was exercise on using XML parsers specifically, then this method of parsing would not work; if your goal is to make it work - then this methosd is no worse than any standrad XML parser as the point is to extract only these specific fields. |
Yes it is assignment continue on old one we did. About the GUI it was run. I put picture to see it. If that was exercise on using XML parsers specifically, then this method of parsing would not work. Yes I tried to use XML because it is part of my assignment and I was working on it in class and teacher help us with part. So we add this code to what we have done to make it work with XML. This the code |
Okay, but GUI doesn't run. I when I delete the code that for yan gave me, the GUI back to work. I mean appear again.I really need help. Thanks all of you guys.If you help me to get GUI work too I appreciate that. |
What I changed has noting to do with the GUI - I just poulated HashMap1 earlier and therefore removed some codes of generating HashMap1 Perhaps there is some null pointer associated wuith that. With this NetBeans stuff it is inconvenien for me to run it. Therefore post StackTrace and we'll locate the problem |
thanks man. It works now :). I will take your advice about exception. I think always my problems with catch(Exception e). I will pay attention to that in future. I will let you know if I have something in future with is code.I will sit with my teacher to see if there is any thing else I have to do. |
This teacher won't accept what we have done :( not easy teacher. He needs use XMLParser. He gave us example and we can use as much as we can to make it run our converter cod run by using XML Parsing. He wouldn't recommend submitting the code that we have done", because he is actually looking for is use of the XML parser as seen when he showed that XMLParser.java file on Products.xml. I am try to modify XMLParser.java so that it parses currencies instead of products. So, it will parse the XML from Rates.xml, and look for the cube, currency, rate, and value of the rate. What I have going on is string parsing, he will take off a lot of points for not using the StAX API for XML. I should keep my GUI that I built from the last project, and try modifying XMLParser.java from course documents to suit your needs. I put XML file and XMLParser down. This assignment never finish and hard teacher :(. The example he gave us : This XML file does not appear to have any style information associated with it. The document tree is shown below. |
No , I just got some help from here and not all code but part of it,and he will not mind if I got some help. But what he need not exactly what we have done here as I explained before we are going to use XML Parser. I thought it is okay for my teacher if I did differently. |
>> I thought it is okay for my teacher if I did differently. As long as he doesn't think someone here either gave you or endorsed that code, it's probably not too bad. He will explain to you, if you don't know already (i suspect you have some idea) why the approach in the accepted solution is completely wrong |
I will try it and I hope he will not struggle me again. I will try it and see if everything is fine. Thanks for yan. |
I reviewed with teacher and see where I am and fix everything before due date. |
And tell your teacher that your original code was 10 times simpler and required 10 times less time to write and gave exactly the same result and, if the world would not be full of dogmatic folks who cause us waste so much resources absolutely in vain, we would all have been already 10 times richer, 10 times healthier, just because we would have been in the first place 10 times wiser |
>>And tell your teacher that your original code was 10 times simpler and required 10 times less time to write ROFL. Your teacher, if you follow him carefully, will teach you how to write 'dogmatic' (read GOOD) code - which is *exactly* the kind of code you want. |
Do I have to connect first cod to second code. We can't use old one and add XMl parser and get some code from teacher example. |
but I couldn't, I thought we don of it. I know I became annoy but I need help. I accepted because I thought it will work for my teacher. |
I use first one and I didn't change anything. Should I put them to gather?. I have not use the second code you put.. |
Can you please you give me the "Converte.Java" that you put two codes and works? I still have problem with name of the class as First code name the class Converter and package Converter and for second one the code has different class name. and give error. |
I am really exhausted from This code never come with me correct. Always something wrong. I will let you know man if I still have problem. I don't know what's wrong with |
It cannot find file XMLParser - did you put file XMLParser which I sent you into the Converter folder next to Converter.java file? In folder you should have them side by side and exactly my file NetBeansFolder\src\Converter\Converter.java NetBeansFolder\src\Converter\XMLParser.java |
remove this line from Converter.java import com.sun.org.apache.xerces.internal.parsers.XMLParser; or maybee better take again my files which I posted ID:37247344 and make sure whatever Netbeans is trying to change in the code - refuse all changes - don't allow it to update - they should work exactly as they come form me This line was added at the time when you initially put my Converteer but diidn't put my XMLParser and beciuse of that line it fails |
It was a bad idea to name our own custom file XMLParser becuase this name is used by many packafges. But you sennt me such file and I didn't cange the name as it worked for me with that name. Anywasy now is not the time to change - make sure the code is exactly as I posted and it should work |
It is works but what I did I took the code you posted above and I went to Converter and STC then replace those file and it works but Old GUI doesn't work and when I compile the cod I got other GUI like what you have. when I tried to run old GUI design.but until know it is run I still need to work on it. later.Thanks. I hope to see you again later if you don't mind to see if completely satisfied. |
Yes, it works. But after I copied both Converter.Java and XMLParser from Above then I replaced them with mine. Also I got same picture that you pasted to show me that cod is works. Other thing I meant by Old design like this picture not any more works. I have to figure out. |
yes.Thanks I think it's fine. I hope my teacher will not struggle me again. |
What does mean "Event Handlers don't work - currency conversion doesn't work". teacher responded when he tried it. The code work find and convert. Do you think there is something else , I might miss? |
I have no Idea, I compile it and it works and convert on my computer very good. Is this mean something or it doesn't matters in this picture |
Okay thanks , I will use it for my experience and learning .But the teacher will not change the grade he gave me. I just want know is this warning consider something wrong with code or fine. |
Do you think this red lines means "Event Handlers don't work - currency conversion doesn't work"? |
>I just want know is this warning consider something wrong with code or fine That depedns on the point ov view. In my mind it was better as it was with the warning. What your teacher thinks - I cannot guess. Besides, this code which generates this warning comes form your teacher. So, I don't think it will affect the grade. >Do you think this red lines means "Event Handlers don't work - currency conversion doesn't work"? No I don't think so. |
Can you please show me where did change to make that red line disappeared or which code you adjusted? |
I wouldn't tell him but for my personal, I have to learn how to avoid this red line when I want to do something similar in future. |
I got his answer. He remarked txtFields and he said the the project should convert when you write numbers at first txtFeid immediately and give you the result on the second field not just you write number in the field and then select currency then do convert. He need the listener in all four options. We did only for selections but he haven't put any code in Txtfields. |
That is easy to do - just add ActionListener to both TextFields and then determine which element generates event, read the number form that one, and read currencies which are set in the comboboxes and then do the same calculation as you do know and then populated the other textfiled (the one which did not generate event) with the result. I'm sure by niow you can do that modification yourself. |
Thanks.I did as you did , but it same, it doesn't' change any thing like when I write number in Txtfield do nothing. I mean nothing change in the second txtField. |
I did add this part to Txtfield but it doesn't work why?I seems not easy to do. |
Take my code from 37287106 and it should wiork It works from me - it should work for you. Make sure that you make RETURN after typing the last chracter in the textfiled - it would not work otherwise - it acnnot know if you ended input With RETURN -it must work -but use the whole my code instaed ofg your Converter.java |
Can you please look to this code and run it. I might explained what I need in wrong way. This code will show you exactly. Please check it. |
I did put Return but Still doesn't work . This what I have. |
Can you send me the file. Because I think for me no way to get it work. I coped exactly. |
Okay, Thanks . I give up. So tired of Java. If I have to work with java and each time problem like this.I might end up sick. I can't try any more. |
I think you should just study it from earlier stage. I think this program and this activity is too complex for your stage of mastering java environment. You should start with more simple programs and first be more compfortable with all things about IDE, packages, and this kind of stuff. And more stepwise learning should not be so painful. |
I really like Java and programing and I am trying as much as I can. I will try until I become familiar with everything.I think to be good at it not easy and not coming even in three months of practicing. I am trying to understand every single thing in the cod and what does it mean. I like this webside when I have hard time for sure I can see who will help me here. I appreciate your help. |
I just want to ask you. Is there something you changer other then put this code inside TxtField? |
Okay even I didn't change your code at all but I will do my best to figure even if I spend all my day to figure it. Thanks |
Sorry, I meant the part in txtField didn't work on my code or on my computer. Thanks for your help. |
Sorry, please be clear. This is not understandble: >part in txtField didn't work on my code or on my computer I'm asking - did you take my file, posted ID:37288353, did you put it in your project folder replacing yours - and then ran it and after you enetered number in textfield and then Enter the number in another textbox didn't change? Please, reply clearly without ambiguities, what you did, with what code, and what you observed If it did not work, did you see any exception? |
I meant I tried and I didn't get txtfiiel yet work, I am sue I have problem.There is no error or exception and it is run perfect except the txtfield part.I coped yours and I might missing something. I will let you know when I fiend what I am missing. I tried to be more clear as much as I can.I need just more time.I will come back to you and tell you if I still have same question. |