Re: XML DOM issues in IE and Opera
Jim Auldridge <[email protected]>
| Newsgroups | gmane.comp.web.dom.wdf |
|---|---|
| Message-ID | <[email protected]> |
getElementById() is a standard DOM method, so far as I know. It is used all the time in web pages to access a particular element with specified ID from within a HTML document. But HTML documents are only one kind of document in which standard DOM methods are available. Any document, XML included, should have getElementById() available to it. Interestingly enough, though, getElementById() doesn't look at the attribute named 'id', it looks at ANY attribute whose data type is defined in the DTD as ID. This is better explained here: http://blog.bitflux.ch/wiki/GetElementById_Pitfalls Now, I say all that, but I don't guarantee I am right. This is all my understanding based on the research I have done. And, as I said, it all works fine in Firefox as long as I have a DTD that defines an attribute as data type ID. Thanks for the reply, Jim On 11/5/05, Lon Boonen <[email protected]> wrote: > Since when is getElementById an XML DOM method? I never heard of it. But I may be wrong. > At the very least its very un-xml-like to do getElementById. There are no id's in XML. Sure you can make them, but they have no special meaning, so why would there be a method to get elemnts by them? > > You should use selectSingleNode("//*[@id='" + myId + "']") for instance. > > groetjes Lon > > ________________________________ > > From: [email protected] on behalf of Jim Auldridge > Sent: Sat 05/11/2005 13:37 > To: [email protected] > Subject: [wdf-dom] XML DOM issues in IE and Opera > > > > I am having a problem working with DOM methods in an XML document in > IE and Opera. > > If you go here: > http://www.jaaulde.com/test_bed/XML-DOM/ > and click the button at the top, my AJAX library get's and XML > document, and you should see the 5 boxes fill in with appropriate > data. > > That data is, in order, the headers returned when the AJAX request > kicked off, the responseText, the data type of the responseXML (should > be object) and the data type of responseXML.getElementById('code1') > (should be object), and the actual value of the text within the > element with ID 'code1'. (the element with the id 'code1' is one of > the error elements in the XML) > > The only place this is working correctly is Firefox. So if you want to > see the correct thing, use Fx. > > In IE everything is right until the last 2 boxes which are empty and I > get an error saying that the reponseXML document doesn't support the > method getElementById(). In Opera I get the same basic error, but the > second to last box is correct--it says object. So the last box doesn't > work right. > > So IE and Opera are not recognizing reponseXML as a XML document, or > at least not fully supporting the DOM. You can see in the headers that > the correct Content-Type (application/xml) is being sent. And I > manually set at the server to 'text/xml' to see if that was the issue, > but it is not. > > Does anyone know what gives?? I have debugged my little heart out. > > > > Unsubscribe > [email protected] > > List info > http://www.quirksmode.org/dom/list.html > Yahoo! Groups Links > > > > > > > > > > > [Non-text portions of this message have been removed] > > > > > Unsubscribe > [email protected] > > List info > http://www.quirksmode.org/dom/list.html > Yahoo! Groups Links > > > > > > > ------------------------ Yahoo! Groups Sponsor --------------------~--> Get fast access to your favorite Yahoo! Groups. Make Yahoo! your home page http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/9rHolB/TM --------------------------------------------------------------------~-> Unsubscribe [email protected] List info http://www.quirksmode.org/dom/list.html Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/wdf-dom/ <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/