Commenting HTML in IHTMLDocument2

I am able to get particular nodes from an IHTMLDocument2 document. However
all my attempts at commenting out certain nodes have not worked.

Does anyone have any tips/pointers on how to accomplish this and then save the HTML
to a file after the changes have been made?
 
I DO NOT want to just manipulate the HTML source, I want to manipulate the
IHTMLElement that I have.
LVL 26
Eddie ShipmanAll-around developerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

heretoreadCommented:
Could you expand a little on that, by nodes do you mean the HTML tag elements and what do you mean by comment them out?
0
Eddie ShipmanAll-around developerAuthor Commented:
Yes. In IHTMLDocument2, the tags can be IHTMLElements or IHTMLDOMNodes.

For instance:

<TR>
  <TD colSpan=2>
    <DIV class=line_item_name>
      <A href="/products/<!--
        #ystore_catalog id=secondssgiftset field=line-lower-->/<!--
        #ystore_catalog id=secondssgiftset field=code-->.html"><!--
        #ystore_catalog id=secondssgiftset field=name -->
      </A>
    </DIV>
    </TD>
</TR>

I want to be able to comment out the whole <TR> tag.
0
Eddie ShipmanAll-around developerAuthor Commented:
Like this:

<!--
<TR>
  <TD colSpan=2>
    <DIV class=line_item_name>
      <A href="/products/<!--
        #ystore_catalog id=secondssgiftset field=line-lower-->/<!--
        #ystore_catalog id=secondssgiftset field=code-->.html"><!--
        #ystore_catalog id=secondssgiftset field=name -->
      </A>
    </DIV>
    </TD>
</TR>
-->

0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

DragonSlayerCommented:
Ed just a thought... why not just delete the element?
0
Eddie ShipmanAll-around developerAuthor Commented:
Because we may need to uncomment the row at a later time.

This is a list of products in a Yahoo! store catalog. When we no
longer want to offer the item for sale, we want to comment out
the row. When we want to begin offering it again, we will
uncomment it.

E.
0
heretoreadCommented:
But then couldn't people just look at the html source and see it.

Can you use the innerHTML property to comment it?
0
DragonSlayerCommented:
or alternatively, access the style and set display:none?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Eddie ShipmanAll-around developerAuthor Commented:
heretoread:
Yes but the actual HTML code is generated from the Yahoo! store system and, personally, I don't know
if it will even be seen in the resultant HTML.

No, I have tried modifying the OUTERHTML and it returns an exception.

DragonSlayer:
Hmm, Never thought about setting the display style...let me look at that because I may be able to do that.
0
Eddie ShipmanAll-around developerAuthor Commented:
looks like that is going to work, thanks Slayer!!!
0
DragonSlayerCommented:
No probs! Glad it worked Ed! ;-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.