Re: about setSelect of HTMLOptionElement?
Jacob Kjome <[email protected]> Sun, 21 Sep 2003 22:40:55 -0500
| Newsgroups | gmane.comp.java.enhydra.xmlc |
|---|---|
| Message-ID | <[email protected]> |
At 09:23 AM 9/22/2003 +0800, you wrote:
>hi,
>
>I'm using xmlc 2.2 with tomcat 4.1.27, but when calling setSelect method
>of HTMLOptionElement, the browser tell me:
>
>java.lang.NoSuchMethodError:
>org.w3c.dom.html.HTMLOptionElement.setSelected(Z)V
This is to be expected since the HTML DOM Level1 spec doesn't define
setSelected(). The reason why you are probably familiar with that method
is that Xerces-1.4.4 shipped with an unofficial version of the HTML DOM
Level2 spec which was in the same namespace as the Level1 package. The
package name has since been changed to avoid namespace conflicts between
HTML DOM Level1 (org.w3c.dom.html) and Level2. (org.w3c.dom.html2).
See the API for the HTML DOM Level1 and DOM Level2 here:
http://xml.apache.org/xerces2-j/javadocs/api/
I removed the unofficial version of the dom api from XMLC's internal xerces
libs. All standard api's now come from xml-apis.jar (or xmlParserAPIs.jar
which is the same archive with a different name).
The alternative would be to use
HTMLOptionElement.setDefaultSelected(). However, I'd avoid that since
Xerces2 doesn't seem to have it implemented correctly.
>Then I changed setSelect() to setAttribute("selected","selected"),
>everything seems ok.
>
>Any suggestion? Thanks!
That's exactly how you need to do it. See the XMLC archives and the
Xerces-j archives for discussions about this issue.
Jake
>linuxman
>===========
>Do you love Debian?
>
>_________________________________________________________________
>ÏíÓÃÊÀ½çÉÏ×î´óµÄµç×ÓÓʼþϵͳ¡ª MSN Hotmail¡£ http://www.hotmail.com
>
>_______________________________________________
>XMLC mailing list
>[email protected]
>http://www.enhydra.org/mailman/listinfo.cgi/xmlc