Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / November 2007

Tip: Looking for answers? Try searching our database.

removeNamedItem("xsi:nil") causes 0x80043001 COM Error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
PeterB - 13 Nov 2007 06:41 GMT
When attempting to remove the xsi:nil attribute in IP2003, I receive the
following error:

System.Runtime.InteropServices.COMException
Exception from HRESULT: 0x80043001
  at
Microsoft.Office.Interop.InfoPath.SemiTrust.IXMLDOMNamedNodeMap.removeNamedItem(String name)
  at
Microsoft.Office.Interop.InfoPath.SemiTrust.IXMLDOMNamedNodeMapWrapper.removeNamedItem(String name)
  at
ProductExpiryMaintenance.ProductExpiryMaintenance.ReplaceMainProductListWithSecondary()
  at
ProductExpiryMaintenance.ProductExpiryMaintenance.OnLoad(DocReturnEvent e)
  at
Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2_SinkHelper.OnLoad(DocReturnEvent pEvent)

This is the piece of code causing the issue:

IXMLDOMNode productListMain =
thisXDocument.DOM.selectSingleNode("//products/retail");                    

if (productListMain.attributes.getNamedItem("xsi:nil") != null)
{
    productListMain.attributes.removeNamedItem("xsi:nil");
}

This is an example of XML:

<ns1:productExpiryMaintenance
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ns1="http://Schemas.Company.productExpiryMaintenance"
xmlns:pl="http://Schemas.DataServices.ProductList"  
xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-09-04T09-41-22" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003">
    <companyLegalName></companyLegalName>
    <contactName xsi:nil="true"></contactName>
    <pl:productList>
        <companyCode></companyCode>
        <documentRefNo xsi:nil="true"></documentRefNo>
        <contractNo xsi:nil="true"></contractNo>
        <products>
            <retail xsi:nil="true"></retail>
            <foodservice  xsi:nil="true"></foodservice>
        </products>
    </pl:productList>
    ...
</ns1:productExpiryMaintenance>

Anyone got any ideas what causes this?

(I've attempted to provide the selectionNamespaces for the "pl" namespace
prefix but with no luck).

Thanks.
PeterB - 15 Nov 2007 01:13 GMT
I think InfoPath cannot un-nil a complex type or one with a repeating node
beneath it. You can happily run removeNamedItem("xsi:nil") on an element, but
if it's a record/complex type, it dies.

So perhaps you need to contruct your own fully-expanded complex type and
replace the existing nillable one with this one. I've worked around the issue
by forcing a BizTalk Map to create 1 item in the repeating list and injecting
nil (functoid) into each of its elements, thus expanding the complex type.

> When attempting to remove the xsi:nil attribute in IP2003, I receive the
> following error:
[quoted text clipped - 49 lines]
>
> Thanks.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.