logo       

XHTML: Return General Node When Calling GetElement Methods: msg#00004

java.enhydra.xmlc

Subject: XHTML: Return General Node When Calling GetElement Methods

I am hoping that someone might be able to answer this. Below are two very
scaled down code examples. The first shows an html page and the java code to
access the element once the html page has been compiled via xmlc. The second
shows the same thing except for an XHTML file. In the second version,
getElementSomeId() does not return an HTMLAnchorElement. Instead it returns a
general element. Since element is the return type, a cast is needed to get
anchor tag specific methods.

Is there a way to make XHMTL generated objects act like HTML objects so no
casting is needed?


Index.html page:
<a href=”#” id=”someId”>Click Here</a>

Java code used to access someId:
HTMLAnchorElement someId = indexHTML.getElementSomeId();
someId.getHref()…


When using an XHtml file it looks like this:
index.xhtml page:
<a href=”#” id=”someId”>Click Here</a>

Java code used to access someId:
HTMLAnchorElement someId = (HTMLAnchorElement)indexHTML.getElementSomeId();
someId.getHref()…




Thank you,


Kyle Aaron
aaronka@xxxxxxxxxxxxx


------------------------------------------------------------------------------
This message may contain confidential information, and is intended only for the
use of the individual(s) to whom it is addressed.


==============================================================================


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise