how can we remove an attribute from IXMLDOMNodePtr??? - XML SOAP

This is a discussion on how can we remove an attribute from IXMLDOMNodePtr??? - XML SOAP ; wanted to remove "Name" attribute from the below tag, but i am only having IXMLDOMNode pointer and not IXMLDOMElement pointer of "Option". removeAttribute method is only available in IXMLDOMElement interface. <Option Name="ABCD">0</Option> I tried the below code and it works ...

+ Reply to Thread
Results 1 to 2 of 2

how can we remove an attribute from IXMLDOMNodePtr???

  1. Default how can we remove an attribute from IXMLDOMNodePtr???

    wanted to remove "Name" attribute from the below tag, but i am only having
    IXMLDOMNode pointer and not IXMLDOMElement pointer of "Option".
    removeAttribute method is only available in IXMLDOMElement interface.

    <Option Name="ABCD">0</Option>

    I tried the below code and it works properly,but my concern is if it is
    correct to just assign pOptionNode to pTempElement.

    MSXML2::IXMLDOMElementPtr pTempElement = pOptionNode; //pOptionsNode is
    IXMLDOMNode of
    "Options".Is this right to do?
    _bstr_t bstrName = "Name";
    hRes = pTempElement->removeAttribute(bstrName);

    If assigning IXMLDOMNodePtr to IXMLDOMElementPtr is incorrect? how can we
    remove an attribute from the available IXMLDOMNodePtr???

    Regards,
    Alamelu N

  2. Default RE: how can we remove an attribute from IXMLDOMNodePtr???

    Proper way is to use QueryInterface() to get an interface pointer to
    IXMLDOMElement. Even it works for you, it can change in the future since it
    is an implementation detail.

    --
    S. Huseyin Ulger [MSFT]
    MSXML Dev


    "Alamelu" wrote:

    > wanted to remove "Name" attribute from the below tag, but i am only having
    > IXMLDOMNode pointer and not IXMLDOMElement pointer of "Option".
    > removeAttribute method is only available in IXMLDOMElement interface.
    >
    > <Option Name="ABCD">0</Option>
    >
    > I tried the below code and it works properly,but my concern is if it is
    > correct to just assign pOptionNode to pTempElement.
    >
    > MSXML2::IXMLDOMElementPtr pTempElement = pOptionNode; //pOptionsNode is
    > IXMLDOMNode of
    > "Options".Is this right to do?
    > _bstr_t bstrName = "Name";
    > hRes = pTempElement->removeAttribute(bstrName);
    >
    > If assigning IXMLDOMNodePtr to IXMLDOMElementPtr is incorrect? how can we
    > remove an attribute from the available IXMLDOMNodePtr???
    >
    > Regards,
    > Alamelu N


+ Reply to Thread

Similar Threads

  1. AD attribute does not show up in profile attribute mapping
    By Application Development in forum Sharepoint
    Replies: 0
    Last Post: 08-29-2007, 12:44 AM
  2. Difference between empty attribute and undefined attribute
    By Application Development in forum Javascript
    Replies: 4
    Last Post: 04-24-2007, 09:53 AM
  3. select namespace attribute xmlns as a normal attribute
    By Application Development in forum XML SOAP
    Replies: 6
    Last Post: 12-08-2006, 10:03 AM
  4. Remove duplicated record by SELECT if attribute already selected
    By Application Development in forum XML SOAP
    Replies: 2
    Last Post: 07-27-2006, 01:32 AM
  5. Remove Exchange attribute from users in AD
    By Application Development in forum Microsoft Exchange
    Replies: 1
    Last Post: 12-08-2003, 03:35 PM