Link to home
Start Free TrialLog in
Avatar of Eddie Shipman
Eddie ShipmanFlag for United States of America

asked on

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.
Avatar of heretoread
heretoread

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?
Avatar of Eddie Shipman

ASKER

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

Ed just a thought... why not just delete the element?
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.
But then couldn't people just look at the html source and see it.

Can you use the innerHTML property to comment it?
ASKER CERTIFIED SOLUTION
Avatar of DragonSlayer
DragonSlayer
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
looks like that is going to work, thanks Slayer!!!
No probs! Glad it worked Ed! ;-)