Vitaly Kuvaev wrote: > nsCOMPtr<nsIDOMXMLDocument> domXmlDoc ( do_QueryInterface ( domDoc ) ); > > PRBool boolRes; > domXmlDoc->Load ( url, &boolRes ); > > nsCOMPtr<nsIDOMElement> documentElement; > domDoc->GetDocumentElement ( getter_AddRefs(documentElement) ); > > In this case, xmlDoc->Load returns NS_OK and boolRes has PR_TRUE, but > when I'm calling domDoc->GetDocumentElement, it returns null. However, > if I return domDoc to the calling JavaScript, I can access the > documentElement and traverse the DOM.
One possibility might be because the document hasn't finished loading yet when you try to get the document element. nsIDOMXMLDocument defaults to asynchronous loading (see the async attribute), so you might be trying to get something that hasn't loaded yet. _______________________________________________ dev-tech-xpcom mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-xpcom
