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 / August 2005

Tip: Looking for answers? Try searching our database.

How to remove attribute via Managed Code for '#PCDATA' is in nil content ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
digitor - 23 Aug 2005 05:55 GMT
Does anyone know how to do the following via c# managed code? I wish to
remove the attribute in the similar way in c# because I get the error:
'#PCDATA' is in nil content.

    // Receive a reference to the element to be filled.
    var objDataElement =
XDocument.DOM.selectSingleNode("/my:myFields/my:field1");

    //Determine whether the xsi:nil attribute is set for this
    //element. If so, remove the xsi:nil attributes so that
    //the value can be set.
    if (objDataElement.getAttribute("xsi:nil"))
         objDataElement.removeAttribute("xsi:nil");

    //Set the value of the element.
    objDataElement.text = "10.0";

Microsoft have the following script example here:
http://support.microsoft.com/?id=826998
digitor - 23 Aug 2005 23:07 GMT
ok looks like I have solved this one myself.

simply do:

IXMLDOMNode xmlDOMPrice =
thisXDocument.DOM.selectSingleNode("/my:Company/my:CostsGroup/my:Price");
xmlDOMPrice.attributes.removeNamedItem("xsi:nil");

easy!
 
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.