Problems with appendChild

165 views
Skip to first unread message

Ryan

unread,
May 2, 2007, 12:12:44 AM5/2/07
to Google Web Toolkit
I am trying to create an XML Document on the client side with the
following code, but it doesn't seem to work at appendChild() if I call
it consecutively. I've pasted the code and the error.

private Document genRequestMsg(){
Document xml = XMLParser.createDocument();

Element e = xml.createElement("action");
e.setAttribute("type", "request");
xml.appendChild(e);

e = xml.createElement("constraint");
//xml.appendChild(e); ERROR

e = xml.createElement("page");
e.appendChild(xml.createTextNode(new Integer(pageNum).toString() ));
//xml.appendChild(e); ERROR

e = xml.createElement("numperpage");
e.appendChild(xml.createTextNode(new
Integer(numPerPage).toString() ));
//xml.appendChild(e); ERROR

return xml;


[ERROR] Unable to load module entry point class com.myapp.client.MyApp
com.google.gwt.xml.client.impl.DOMNodeException: Error during DOM
manipulation of: <action type="request"/>
at com.google.gwt.xml.client.impl.NodeImpl.appendChild(NodeImpl.java:
84)
at com.myapp.client.xmlMessage.genRequestMsg(xmlMessage.java:50)
at com.myapp.client.xmlMessage.toString(xmlMessage.java:74)
at java.lang.String.valueOf(String.java:2615)
at java.io.PrintStream.print(PrintStream.java:616)
at java.io.PrintStream.println(PrintStream.java:753)
at com.myapp.client.ui.ListTabWidget.<init>(ListTabWidget.java:32)
at com.myapp.client.MyApp.onModuleLoad(MyApp.java:42)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
Caused by: com.google.gwt.core.client.JavaScriptException: JavaScript
Error exception: HIERARCHY_REQUEST_ERR: DOM Exception 3
at
com.google.gwt.dev.shell.mac.ModuleSpaceSaf.invokeNative(ModuleSpaceSaf.java:
200)
at
com.google.gwt.dev.shell.mac.ModuleSpaceSaf.invokeNativeHandle(ModuleSpaceSaf.java:
98)
at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeHandle(JavaScriptHost.java:
79)
at
com.google.gwt.xml.client.impl.XMLParserImpl.appendChild(XMLParserImpl.java:
36)
at com.google.gwt.xml.client.impl.NodeImpl.appendChild(NodeImpl.java:
80)
at com.myapp.client.xmlMessage.genRequestMsg(xmlMessage.java:50)
at com.myapp.client.xmlMessage.toString(xmlMessage.java:74)
at java.lang.String.valueOf(String.java:2615)
at java.io.PrintStream.print(PrintStream.java:616)
at java.io.PrintStream.println(PrintStream.java:753)
at com.myapp.client.ui.ListTabWidget.<init>(ListTabWidget.java:32)

Ryan

unread,
May 15, 2007, 4:38:24 AM5/15/07
to Google Web Toolkit
Don't know what I was thinking on this, but I fixed the stupid
errors...

Is there any convenient way to convert a Document object to a string
on the client side? I haven't found away so I have commented it out
and am now just generating my own string since the Documents are
simple.

Sagar Joglekar

unread,
Mar 10, 2014, 7:57:51 PM3/10/14
to google-we...@googlegroups.com, Google Web Toolkit
hey Ryan, 
how were you able to solve this ? 
I am doing something similar on the client side, also I see this issue only with internet explorer. Not with Chorme or Mozilla or Opera. 
Your help is highly appreciated. 
Thanks

Thomas Broyer

unread,
Mar 11, 2014, 5:29:26 AM3/11/14
to google-we...@googlegroups.com, Google Web Toolkit


On Tuesday, March 11, 2014 12:57:51 AM UTC+1, Sagar Joglekar wrote:
hey Ryan, 
how were you able to solve this ? 
I am doing something similar on the client side, also I see this issue only with internet explorer. Not with Chorme or Mozilla or Opera. 
Your help is highly appreciated.

The error here was that he tried to have more than one "document element"  (aka "root element").
Reply all
Reply to author
Forward
0 new messages