Click here to Skip to main content
15,920,596 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I am trying to comment out an xml node but not sure how to.
I am able to change the attributes inside the node.
The XML format is:

XML
<Main>
  <Services>
   <Service name="01">
    <Uses>
     <Use type="front">
      <Member name="01"/>
     </Use>
    </Uses>
   </Service>
  </Services>
  <Adaptors>
   <Adaptor name="cash" start="true"/>
  </Adaptors>
</Main>


What I would like to do is to comment out the adaptor with the name "cash".

Any ideas?

Additional information copied from comment below
Sorry, don't think my question was very clear.

I am using vb.net.
Im loading the xml file as a new XmlDocument.
I am then doing the following:
VB
attr = MyXML.SelectSingleNode("/Main/Adaptors/Adaptor[@name='cash']")

Am able to comment the node using vb.net?
Posted
Updated 14-Mar-13 23:22pm
v3
Comments
Sergey Alexandrovich Kryukov 13-Mar-13 19:12pm    
Not really a valid question. Anyway, programmatically, or what? What XML API do you use?
—SA

1 solution

Use the standard comment characters. [Edit: I see you wanted to comment out the Adapters node] For example, if you want to comment out the 'Adapters' node,

XML
<Main>
  <Services>
   <Service name="01">
    <Uses>
     <Use type="front">
      <Member name="01"/>
     </Use>
    </Uses>
   </Service>
  </Services>
  <Adaptors>
   <!-- <Adaptor name="cash" start="true"/> -->
  </Adaptors>
</Main>
 
Share this answer
 
v2
Comments
Member 9909084 14-Mar-13 5:03am    
Sorry, don't think my question was very clear.

I am using vb.net.
Im loading the xml file as a new XmlDocument.
I am then doing the following:
attr = MyXML.SelectSingleNode("/Main/Adaptors/Adaptor[@name='cash']")
Am able to comment the node using vb.net?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900