This project has moved and is read-only. For the latest updates, please go here.

Can I add attributes in htmlNode?

Topics: Developer Forum, User Forum
May 15, 2010 at 11:26 AM

Hey ,

I want to know that is there any way that i can load my html page , and then get to the tags in html Body htmlNode , and then change the attributes ( id , src  etc ) or add attributes to htmlNode like I want to add (id , omouseover , onmouseout , onclick ) and such attributes, or to change their value.

I do these changes with all descendants of Body tag.

Well, i did all this, but i ve found that, i can change attributes value, but i cannot add new attributes and assign them values, because when i do that the first case, i can save back the changes. but in the second case, when i try to save, my stack overflows, thats some infinite loop.

If I am doing something wrong, please let me know.


May 15, 2010 at 1:25 PM
Edited May 15, 2010 at 1:29 PM

Well , I have found something ,

As i am new to htmlagility, i was doing some wrong i guess, what i was doing,

i got all the descendents from body tag and added/changed the values for attributes

but then i got that in descendents i also get htmlNode with name prop "#text". that is not like an html tag to add attributes in that.

when i applied a condition to name=="#text" and made changes to the rest of tags. Application got smooth.

My appologize for mispercieving the behaviour.


N still dear friends, if i am doing anything wrong. I ld be grateful to know, N one more thing,

 if anyone can tell me where to find help , the right way to use this lib , else then .chm file. that doc is kewl and helpful but it does not tell how to do what =/ .