Aspose.HTML Element.RemoveAttribute throws an error

Aspose version 23.12.0

Object reference not set to an instance of an object.
at Aspose.Html.Dom.Element.f8hsggjna863vcr32wwt5v5publwm8m2 ​ (QualifiedName ,  ,  , ​ )
at Aspose.Html.Dom.Element.(Element ,  ,  ,  , ​ )
at Aspose.Html.Dom.Element.RemoveAttribute(String qualifiedName)

@Slava.makagonov

Would you kindly try using 24.1 version and if issue still persists, please share your complete code snippet with sample file so that we can test the scenario in our environment and address it accordingly.

Hello @asad.ali ,
The same behaviour is observed with version 24.1.
The sample code is below, it worked with the version 22 of Aspose.HTML


			Aspose.Html.License lic = new Aspose.Html.License();
			using ( Stream str = File.OpenRead(licenceFileName) ) {
				lic.SetLicense(str);
			}

			string testHTML = @"<!DOCTYPE HTML>
<html>
	<body onclick=""doSomething()"">
	</body>
</html>";
			using HTMLDocument hDoc = new HTMLDocument(testHTML, ".");

			const string onClickAttrName = "onclick";

			foreach ( Element el in hDoc.DocumentElement.QuerySelectorAll("*") ) {
				string onClickVal = el.GetAttribute(onClickAttrName);
				if ( !string.IsNullOrEmpty(onClickVal) ) {
					el.RemoveAttribute(onClickAttrName);
				}
			}
		}

@Slava.makagonov

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): HTMLNET-5266

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.