Hi,
I am also getting the same error

com.google.gwt.xml.client.impl.DocumentImpl cannot cast to
com.google.gwt.dom.client.Document

This is my code

public void onResponseReceived(Request request,
                                                Response response) {
                                        // TODO Auto-generated method stub
                                        Document xmlDoc =  (Document) 
XMLParser.parse(response.getText
());
                                        Element root = (Element) 
xmlDoc.getDocumentElement();
                                        final int randNum = Random.nextInt(25);
                                        Element randomVid = (Element) 
root.getElementsByTagName
("video").getItem(randNum);

                                }

I tired importing the what John has written but its not accepinting
half of these imports, saying that remove unsed imports.

any idea what should i do ?

On Jun 25, 8:14 pm, G <gaur...@gmail.com> wrote:
> That was helpful. Thanks. Wonder why the name of classes was named
> like this...
>
> Anyway, my current problem is :
>
> Node n = (Node) node.getFirstChild();
> Window.alert(n);
> String text = n.getNodeValue();
>
> "text" returns null even though when I try to print "n" there is some
> text. whats wrong with getNodeValue() ??!
>
> On Jun 25, 6:00 pm, John Ivens <john.wagner.iv...@gmail.com> wrote:
>
> > I seem to remember that there are two different XML libraries..
> > I used these imports:
>
> > import com.google.gwt.xml.client.CDATASection;
>
> > import com.google.gwt.xml.client.Document;
>
> > import com.google.gwt.xml.client.Element;
>
> > import com.google.gwt.xml.client.NodeList;
>
> > import com.google.gwt.xml.client.Text;
>
> > import com.google.gwt.xml.client.XMLParser;
>
> > This inherits tag:
>
> > <inherits name='com.google.gwt.xml.XML'/>
>
> > On Thu, Jun 25, 2009 at 3:50 PM, G <gaur...@gmail.com> wrote:
>
> > > Hello -
>
> > > I am little frustrated with GWT, firstly importing external jar in GWT
> > > isn't trivial and secondly simple XML parsing doesnt work.
>
> > > At this point, I dont care much about importing external jars and will
> > > leave that for later.
>
> > > What I dont understand is why simple XML parsing is not working ... I
> > > am getting no compile time errors.. using GWT gwt-windows-1.5.3.
>
> > > In my project .gwt.xml I added    <inherits
> > > name="com.google.gwt.xml.XML" />
>
> > > I am running in the hosted mode and it bombs with the exception:
> > > java.lang.ClassCastException:
> > > com.google.gwt.xml.client.impl.DocumentImpl cannot cast to
> > > com.google.gwt.dom.client.Document
>
> > > Even this doesn't work:
> > > Document messageDom = (Document) XMLParser.parse("<?xml version='1.0'?
> > > ><message></message>");
>
> > > Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to