Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7763143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:35:29+00:00 2026-06-01T14:35:29+00:00

Let’s imagine that I have a result of evaluating XPath expression //node/@*. MSXML6 returns

  • 0

Let’s imagine that I have a result of evaluating XPath expression “//node/@*”. MSXML6 returns a set of IXMLDOMNode objects which actually are IXMLDOMAttribute object.

Question: Is there a way to remove that attributes having only an IXMLDOMNode object which represent the attribute?

The problem is that MSXML allows to remove child nodes only through parent node, but an attribute doesn’t have it (parentNode returns NULL). Consequently I can’t detach an attribute from a node after being extracted using XPath. Is there a way around?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T14:35:30+00:00Added an answer on June 1, 2026 at 2:35 pm

    I think the W3C DOM introduced a property ownerElement but MSXML has never made any attempt to catch up with the W3C DOM. So the best I can think of is XPath and selectSingleNode to find the parent element. Here is an example done with JScript and MSXML 6:

    var doc = new ActiveXObject("Msxml2.DOMDocument.6.0");
    if (doc.loadXML([
        '<root>',
        ' <foo att="1"/>',
        ' <bar att="2"/>',
        '</root>'
    ].join('\r\n')))
    {
      var attributes = doc.selectNodes('//@att');
      for (var i = attributes.length - 1; i >=  0; i--)
      {
    
        attributes[i].selectSingleNode('..').removeAttributeNode(attributes[i]);
      }
      WScript.Echo(doc.xml);
    }
    else
    {
      WScript.Echo(doc.xml);
    }
    

    The output then is

    <root>
            <foo/>
            <bar/>
    </root>
    

    so the approach works. I realize you don’t use JScript but rather probably C++ where you need to add casts to get the right interface exposing a method like removeAttributeNode but the above should suffice to outline the approach.

    As a last note, as you haven’t mentioned any programming language or environment but only VS 2010, MSXML is meant for native code, if you write managed .NET code with C# or VB.NET then you should use the classes in the namespace System.Xml and below.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say that I have a set of relations that looks like this: relations
Let me try to explain what I need. I have a server that is
Let's say that we have an ARGB color: Color argb = Color.FromARGB(127, 69, 12,
Let's say there is a graph and some set of functions like: create-node ::
Let's say I have multiple requirements for a password. The first is that the
Let's say that I have a date in R and it's formatted as follows.
Let's say you have a class library project that has any number of supplemental
Let's say I have an abstract parent class called shape, and that there are
Let's suppose I have a Discussion model, and that a discussion can be tagged.
Let's imagine I have a Java class of the type: public class MyClass {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.