?
Solved

Commenting HTML in IHTMLDocument2

Posted on 2006-04-19
10
Medium Priority
?
310 Views
Last Modified: 2010-04-04
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.
0
Comment
Question by:Eddie Shipman
  • 5
  • 3
  • 2
10 Comments
 
LVL 2

Expert Comment

by:heretoread
ID: 16501701
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
 
LVL 26

Author Comment

by:Eddie Shipman
ID: 16501867
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
 
LVL 26

Author Comment

by:Eddie Shipman
ID: 16501892
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Expert Comment

by:DragonSlayer
ID: 16501900
Ed just a thought... why not just delete the element?
0
 
LVL 26

Author Comment

by:Eddie Shipman
ID: 16502556
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
 
LVL 2

Expert Comment

by:heretoread
ID: 16502613
But then couldn't people just look at the html source and see it.

Can you use the innerHTML property to comment it?
0
 
LVL 14

Accepted Solution

by:
DragonSlayer earned 2000 total points
ID: 16502663
or alternatively, access the style and set display:none?
0
 
LVL 26

Author Comment

by:Eddie Shipman
ID: 16502918
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
 
LVL 26

Author Comment

by:Eddie Shipman
ID: 16527025
looks like that is going to work, thanks Slayer!!!
0
 
LVL 14

Expert Comment

by:DragonSlayer
ID: 16527427
No probs! Glad it worked Ed! ;-)
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question