Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Issues with ISimpleDOMNode->get_innerHTML

0 views
Skip to first unread message

Jon

unread,
Aug 26, 2009, 3:18:43 PM8/26/09
to
I am trying to use "ISimpleDOMNode->get_innerHTML()" and it just
returns E_FAIL. The call to ISimpleDOMNode->get_nodeInfo() works as
expected, and reports a nodeType of "#document". Here is the code I am
using, any help would be much appreciated. I am running this on
Windows.

IAccessible* pAccessible;
HRESULT hr = AccessibleObjectFromWindow(hTarget, OBJID_CLIENT,
IID_IAccessible, (void**)&pAccessible);

if (SUCCEEDED(hr) && (pAccessible != NULL)) {
IServiceProvider *pService = NULL;
hr = pAccessible->QueryInterface(IID_IServiceProvider, (void**)
&pService);

if (SUCCEEDED(hr) && (pService != NULL)) {
ISimpleDOMNode *pNode = NULL;
hr = pService->QueryService(IID_ISimpleDOMNode, IID_ISimpleDOMNode,
(void**)&pNode);

if (SUCCEEDED(hr) && (pNode != NULL)) {
BSTR html;
hr = pNode->get_innerHTML(&html); //Always returns E_FAIL
}
}
}

Alexander Surkov

unread,
Aug 27, 2009, 5:23:28 AM8/27/09
to

Hi. Because get_innerHTML is not supported on HTML documents. I agree
it would be more correct to return S_FALSE in this case because it's
not an error obviously. As well it should return S_FALSE for non HTML
elements and non HTML documents. However on another hand get_innerHTML
can make sense for HTML documents in contrast to non HTML documents
and elements where get_innerHTML isn't applicable at all. But this
feature was never requested by AT vendors. Which option do you expect?

Alex.

Jon

unread,
Aug 27, 2009, 10:00:13 AM8/27/09
to
On Aug 27, 5:23 am, Alexander Surkov <surkov.alexan...@gmail.com>
wrote:

I would like to get the complete HTML for the currently loaded page,
from an external application. Is there any way to do this? If not, is
there a way I can read the values from hidden text fields?
Specifically, I'm trying to read values from HTML elements that look
like this:

<input type="hidden" id="test" value="56456456" />

Through the normal IAccessible interface I can't read the values of
hidden fields. I was hoping that ISimpleDOMNode would be able to do
this. Am I on the right track? Thanks!

Jon

unread,
Aug 27, 2009, 1:46:01 PM8/27/09
to
On Aug 27, 5:23 am, Alexander Surkov <surkov.alexan...@gmail.com>
wrote:

I managed to resolve my issue by digging deeper into the DOM, and
finding a node named "HTML", instead of "#document". Thanks!

none

unread,
Aug 27, 2009, 5:13:06 PM8/27/09
to
> I managed to resolve my issue by digging deeper into the DOM, and
> finding a node named "HTML", instead of "#document". Thanks!

Just a warning - at least in Javascript, grabbing innerHTML from there
will miss the doctype information and any attributes on the html node.
For the doctype information, you may need to go back to that #document
node and QI for a ISimpleDOMDocument.

Alexander Surkov

unread,
Aug 28, 2009, 4:18:04 AM8/28/09
to

Right. It would be better if you get innerHTML on HTML body element or
on container of your HTML input. We don't expose HTML input to AT
because it is not visible. So you don't need innerHTML on document,
right?

Alex.

Alexander Surkov

unread,
Aug 28, 2009, 4:22:10 AM8/28/09
to

At least the meantime ISimpleDOMNode::get_innerHTML is the same like
for JS since get_innerHTML calls DOM's innerHTML property. That's the
reason it fails when it is called on document.

Alex.

0 new messages