Pages: 1
Print
Author Topic: Error when trying to set attribute value  (Read 1748 times)
MrPaul
Member

Posts: 29


« on: January 22, 2014, 02:55:29 PM »

Has anyone ever seen this error? I'm getting it when trying to set a DOMNode's attribute value.

"Error HRESULT E_FAIL has been returned from a call to a COM component."

Not very descriptive I know, but when I try setting the attribute name to another value, the application crashes and that's the error returned.

My XML:
<Node attName="False"></Node>

Code:
If mNode IsNot Nothing AndAlso mNode.attributes.length > 0 AndAlso mNode.attributes.getNamedItem("attName") IsNot Nothing Then
    mNode.attributes.getNamedItem("attName").nodeValue = "True"
End If

Before calling this code, another call is made using the Range to set its ReadOnlyContainer to False, just in case. This code used to work using XMetal v3, but doesn't using XMAX v7. If you need more information, please let me know.

Thanks.
« Last Edit: January 22, 2014, 03:11:32 PM by mrpaul » Logged
MrPaul
Member

Posts: 29


« Reply #1 on: January 23, 2014, 10:02:45 AM »

My issue has been resolved. It was related to setting range.ReadOnlyContainer = True for the root node of that document. Some other code prior to setting the attribute value was being called.

So, if you try to set nodeValue on a node that has been set as readonly (or its parent was set to readonly), it will return that error!
Logged
Pages: 1
Print
Jump to: