Element.GetElementsByTagNameNS method

Returns HTMLCollection object containing all elements with a given local name and namespace URI string in document order.

public HTMLCollection GetElementsByTagNameNS(string namespaceURI, string localName)
Parameter Type Description
namespaceURI String The namespace URI string representation.
localName String String representation of local name.

Return Value

An HTMLCollection object is an array-like list of elements.


Refer to official spec.

You may also be interested in documentation.

You can download the complete examples and data files from GitHub.


# .xhtml input file content
<!DOCTYPE html>
<html lang="en"
	<meta charset="UTF-8"/>
	<link rel="stylesheet" href="/styles/main.css"/>
	Custom namespace custom tag content goes here...

# C# code
using System;
using Aspose.Html;
using Aspose.Html.Collections;
using Aspose.Html.Dom;
using (var document = new HTMLDocument(inputHtmlPath))
	// User code goes here

	HTMLCollection htmlCollection = document.GetElementsByTagNameNS("", "customtag");
	Console.WriteLine($"Found: {htmlCollection.Length}");
	foreach (Element element in htmlCollection)

	// User code goes here

*inputHtmlPath - user input xhtml file path.

Console output

Found: 1

Custom namespace custom tag content goes here…

See Also