Re: Reading XML file from localhost

2008-11-13 Thread mives29
to greg, thank you for your insight on the matter. it's not that i want to force using a utility class, its just that, well, its a requirement for me (to use a utility class, since other fellow devs here in my team will use it) and i thought its more convenient. and on the matter of where to place

Re: Reading XML file from localhost

2008-11-11 Thread Jason Morris
When you call any "async" method in GWT, you can think of it as starting in another Thread. This is the plain Java equivalent to your XmlParserUtil class: public class XmlParserUtil { String url; Document doc; public RequestBuilder requestBuilder; String xmlStr;

Re: Reading XML file from localhost

2008-11-11 Thread gregor
Hi Mives29, Jason's solution is correct. If you have TreeX implement his Callback interface, then XmlParserUtil will call TreeX.callback() when it has retrieved and parsed the XML document, so you move the tree building code (getTreeitem()) to start from TreeX.callback(String XML). This will sol

Re: Reading XML file from localhost

2008-11-10 Thread mives29
Hi! I've just re-read your reply, but I cant understand how the interface would affect the program, and how would I use that new getDocument() method of the XmlUtilParser class. Could you provide another example (a working one, if possible)? This whole AsyncCallback/asynchronous stuff of GWT is d

Re: Reading XML file from localhost

2008-11-10 Thread mives29
yes. you got my problem right. now probably tommorow or the day after that, I'll have the chance to re-do my code. For now, back to reading some company documents. Will get back here as soon as I've redone the code. Thanks Jason, mives29 On Nov 10, 5:58 pm, Jason Morris <[EMAIL PROTECTED]> wrote

Re: Reading XML file from localhost

2008-11-10 Thread Jason Morris
Heya, Your basic problem here is that you can't have your XmlParserUtil return a Document object. The doc field will only be filled in when the async RequestBuilder request returns and the parser is finished with the XML string. By that time, your method has already returned. The only way to

Re: Reading XML file from localhost

2008-11-10 Thread mives29
okay, let me be clear on this, again, my code. (now posting full reworked source code) // A composite w/c contains a tree. public class TreeX extends Composite { Document doc; Tree t = new Tree(); int imgUris; XmlParserUtil xmlParser; public TreePol() {

Re: Reading XML file from localhost

2008-11-09 Thread alex.d
You have to accept the asynchronous nature of RPC-Requests in GWT and stop trying to build smth. synchronous around them. This code: --- doc = getDoc(); //(where doc is a Document object) String subject = doc.getElementsByTagName("Image").item(0).getChildNodes().ite

Re: Reading XML file from localhost

2008-11-09 Thread mives29
hi all. ive re-done my code just a while ago(been a busy week) and my code kinda bothers me. here's the code re-done: Entrypoint onModuleLoad() method: doc = getDoc(); //(where doc is a Document object) String subject = doc.getElementsByTagName("Image").item(0).getChildNodes().item(1).toString(

Re: Reading XML file from localhost

2008-11-05 Thread mives29
Oh. I didnt know that! Thanks a lot! Will try to modify it. Thanks again. mives29 On Nov 5, 3:31 pm, Lothar Kimmeringer <[EMAIL PROTECTED]> wrote: > mives29 schrieb: > > > requestBuilder = new RequestBuilder(RequestBuilder.GET,url); > > requestBuilder.sendRequest(null,xmlRcb); > > doc = xmlRcb.g

Re: Reading XML file from localhost

2008-11-04 Thread Lothar Kimmeringer
mives29 schrieb: > requestBuilder = new RequestBuilder(RequestBuilder.GET,url); > requestBuilder.sendRequest(null,xmlRcb); > doc = xmlRcb.getDoc();//calls xmlRcb's getDoc method, w/c > returns sendRequest happens asynchronously, so the callback- method is not called at this time

Re: Reading XML file from localhost

2008-11-04 Thread mives29
Hi. Im having a problem using RequestBuilder. Instead of using an inner class of type RequestCallBack, I created a class that implements it. Here's what I've done, 1)Created a utility class named XmlParserUtil. This will return a parsed XML document. (Document object) 2)Inside, there's 1 method,g

Re: Reading XML file from localhost

2008-11-04 Thread mives29
sammi, thanks for the reply. will try that asap. On Nov 5, 12:34 pm, Sammi <[EMAIL PROTECTED]> wrote: > Hi mives29, >    I just solve the problem. It's quite direct and easy. > > 1. upload your xml file to any webserver, e.g.http://a.b.c/test.xml > > 2. use RequestBuilder to get it. your url. >

Re: Reading XML file from localhost

2008-11-04 Thread Sammi
Hi mives29, I just solve the problem. It's quite direct and easy. 1. upload your xml file to any webserver, e.g. http://a.b.c/test.xml 2. use RequestBuilder to get it. your url. 3. String xmlStr = response.getText(); 4. use XMlParser to parse the xmlStr. that's it. Sample snippet code here:

Re: Reading XML file from localhost

2008-11-04 Thread yunhui song
Hi mives29, I just solve the problem. It's quite direct and easy. 1. upload your xml file to any webserver, e.g. http://a.b.c/test.xml 2. use RequestBuilder to get it. your url. 3. String xmlStr = response.getText(); 4. use XMlParser to parse the xmlStr. that's it. Sample snippet code here:

Reading XML file from localhost

2008-11-04 Thread mives29
Hi. I'm a newbie in GWT, and I've been tasked to create a utility class to parse xml files that the contents would be used in layouting the widgets in its container panel (along with other UI configurations). I've accomplished this by using a service, which uses Java's DOM style of parsing. This