XMLParser can't read external DTD?

99 views
Skip to first unread message

Coolcat

unread,
Nov 1, 2009, 5:34:54 AM11/1/09
to Google Web Toolkit
Hi,
I'm trying to parse an XML document using the XMLParser [1]. I need
the method getElementById(String), which requires to define the ID
attribute in an DTD. When using an internal DTD, everything works
fine. However, using an external DTD would be more convenient. The
problem is getElementById(String) does simply return NULL, when using
an external DTD.

My document is valid according to validome.org [2]. Is this a know
bug? I don't find anything about this, except this old thread from
2007:
http://groups.google.com/group/google-web-toolkit/browse_thread/thread/b04c0d8cb626240a/52639b68922b45ed?lnk=gst&q=DTD#52639b68922b45ed
However, I don't receive any exceptions....getElementById does just
return NULL.

The document:
http://www-users.rwth-aachen.de/Martin.Weusten/upload/shaders.xml
http://www-users.rwth-aachen.de/Martin.Weusten/upload/library.dtd

I'm using "gwt-linux-1.7.1".

best regards,
Coolcat

[1] com.google.gwt.xml.client.XMLParser
[2] http://www.validome.org/xml/validate/?lang=en&url=http://www-users.rwth-aachen.de/Martin.We
usten/upload/shaders.xml

Coolcat

unread,
Nov 1, 2009, 5:39:23 AM11/1/09
to Google Web Toolkit
Ok, the link to vaildome.org seems to long for the Web based group
browser. If the link doesn't work for you:
Go to
http://www.validome.org/xml/validate/
and enter URL
http://www-users.rwth-aachen.de/Martin.Weusten/upload/shaders.xml

Jeff Chimene

unread,
Nov 1, 2009, 11:23:07 AM11/1/09
to google-we...@googlegroups.com
On Sun, Nov 1, 2009 at 3:34 AM, Coolcat <sp...@martin-weusten.de> wrote:

Hi,
I'm trying to parse an XML document using the XMLParser [1]. I need
the method getElementById(String), which requires to define the ID 
attribute in an DTD. When using an internal DTD, everything works
fine. However, using an external DTD would be more convenient. The
problem is getElementById(String) does simply return NULL, when using
an external DTD.

GWT relies on the browser to parse the XML. Are there any browsers that load external DTDs?

Perhaps you can parse the document on your server and send  the results to the client via RPC or JSON?

Coolcat

unread,
Nov 1, 2009, 12:13:02 PM11/1/09
to Google Web Toolkit
On 1 Nov., 17:23, Jeff Chimene <jchim...@gmail.com> wrote:
> GWT relies on the browser to parse the XML. Are there any browsers that load
> external DTDs?
I thought every good browser would support this....it seems that's not
the case. Firefox has this bug open since year 2000:
https://bugzilla.mozilla.org/show_bug.cgi?id=22942

argh!!

> Perhaps you can parse the document on your server and send the results to
> the client via RPC or JSON?
JSON might be an option, I will think about it.

Thanks.

Jeff Chimene

unread,
Nov 1, 2009, 12:54:12 PM11/1/09
to google-we...@googlegroups.com
Maybe serve your document as XHTML?

There might be some issues with the code generated by GWT when using application/xhtml

Coolcat

unread,
Nov 1, 2009, 6:14:14 PM11/1/09
to Google Web Toolkit
XHTML is not a good idea since I need custom tags.

JSON would be perfect if multi-line strings where supported. In need
to load GLSL-Shader code, which is an C-Style language. Writing source
code into one line is not a nice idea.
However, I think I will write some kind of tool which does convert all
newline, tab and so on into normal spaces. The End-User does not need
to read the code, just the graphics driver. Would also save a few
bytes in filesize, but not much since the major part is mesh data
(pure comma separated numbers).

Thanks anyway.

Jeff Chimene

unread,
Nov 1, 2009, 6:42:20 PM11/1/09
to google-we...@googlegroups.com
On Sun, Nov 1, 2009 at 4:14 PM, Coolcat <sp...@martin-weusten.de> wrote:

XHTML is not a good idea since I need custom tags.
 
Use a custom namespace. See for example
http://richui.blogspot.com/2005/02/custom-tags-namespaces-and-dtds.html

A search will turn up more examples. Please ignore my earlier comment about GWT -generated code. Since you're not rendering the document, GWT has no effect.

Coolcat

unread,
Nov 2, 2009, 5:15:42 AM11/2/09
to Google Web Toolkit
On 2 Nov., 00:42, Jeff Chimene <jchim...@gmail.com> wrote:
> Use a custom namespace. See for examplehttp://richui.blogspot.com/2005/02/custom-tags-namespaces-and-dtds.html
Custom namespaces will not help here, because the browser will
probably ignore the ID attribute again. I will do a few tests, but I
assume that JSON is a bit faster for parsing. Also JSON is easier to
implement, even when not using GWT.


Reply all
Reply to author
Forward
0 new messages