nuget server logo nuget api documents
↑

API Docs / Microsoft.VisualBasic.MIME.Html / HtmlElement

HtmlElement

Full name Microsoft.VisualBasic.MIME.Html.Document.HtmlElement Assembly Microsoft.VisualBasic.MIME.Html Members 28

一个标签所标记的元素以及内部文本

00 Remarks

在选择器里:

  • ID 和 类 选择器 区分 大小写
  • 标签选择器、属性选择器不区分大小写

类选择器和 ID 选择器可能是区分大小写的。这取决于文档的语言。 HTML 和 XHTML 将类和 ID 值定义为区分大小写,所以类和 ID 值的大小写必须与文档中的相应值匹配。

—— W3C

01 Syntax

Microsoft.VisualBasic.MIME.Html.Document.HtmlElement

02 Methods

NameOverloadsSummary
Add 2
GetDirectChilds 1 这个函数是应用于判断HtmlElement.getElementsByClassName())或者HtmlElement.getElementsByName())或者HtmlElement.getElementsByTagName()) 函数所返回来的结果,所以不会对InnerPlantText节点产生误判
getElementById 1 Get the element with the specified ID
getElementsByClassName 1 Get all elements with the specified class name
getElementsByName 1 Get all elements with the specified name
getElementsByTagName 1 Get all elements in the document with the specified tag name
hasAttribute 1
GetPlantText 1
ToString 1
GetAllChildsByNodeName 1
GetAllChilds 1
GetHtmlText 1

03 Properties

NameOverloadsSummary
TagName 1 标签名
Attributes 1 标签的属性列表
Element 1 get attribute value by attribute name
id 1 唯一编号是区分大小写的
class 1
HtmlElements 1
IsPlantText 1
name 1
OnlyInnerText 1
IsEmpty 1

04 Fields

NameOverloadsSummary
elementNodes 1 当前的这个节点下面所拥有的子节点
tagIndex 1 大小写不敏感
classIndex 1 大小写敏感
nameIndex 1 大小写敏感
idIndex 1 大小写敏感

05 Members

method Add overload 2 #
Add(String, String)

add tagged attribute value.

Parameters
NameTypeDescription
nameString

the attribute name

valueString

the attribute value string.

method GetDirectChilds #
GetDirectChilds(IEnumerable(Of InnerPlantText))

这个函数是应用于判断HtmlElement.getElementsByClassName()或者HtmlElement.getElementsByName()或者HtmlElement.getElementsByTagName() 函数所返回来的结果,所以不会对InnerPlantText节点产生误判

Parameters
NameTypeDescription
queryIEnumerable(Of InnerPlantText)

-

method getElementById #
getElementById(String)

Get the element with the specified ID

Remarks

The getElementById() method returns the element that has the ID attribute with the specified value. This method Is one Of the most common methods In the HTML DOM, And Is used almost every time you want To manipulate, Or Get info from, an element On your document. Returns null If no elements With the specified ID exists. An ID should be unique within a page. However, If more than one element With the specified ID exists, the getElementById() method returns the first element In the source code.

Parameters
NameTypeDescription
idString

Required. The ID attribute's value of the element you want to get

Returns

An Element Object, representing an element with the specified ID. Returns null if no elements with the specified ID exists

method getElementsByClassName #
getElementsByClassName(String)

Get all elements with the specified class name

Remarks

The getElementsByClassName() method returns a collection of all elements in the document with the specified class name, as an HTMLCollection object. The HTMLCollection Object represents a collection Of nodes. The nodes can be accessed by index numbers. The index starts at 0. Tip: You can use the length Property Of the HTMLCollection Object To determine the number Of elements With a specified Class name, Then you can Loop through all elements And extract the info you want.

Parameters
NameTypeDescription
classnameString

Required. The class name of the elements you want to get. To search for multiple class names, separate them with spaces, Like "test demo".

Returns

An HTMLCollection object, representing a collection of elements with the specified class name. The elements in the returned collection are sorted as they appear in the source code.

method getElementsByName #
getElementsByName(String)

Get all elements with the specified name

Remarks

The getElementsByName() method returns a collection of all elements in the document with the specified name (the value of the name attribute), as an HTMLCollection object. The HTMLCollection Object represents a collection Of nodes. The nodes can be accessed by index numbers. The index starts at 0. Tip: You can use the length Property Of the HTMLCollection Object To determine the number Of elements With the specified name, Then you can Loop through all elements And extract the info you want. Note: In HTML5, the "name" attribute Is deprecated And has been replaced by the "id" attribute for many elements. Use the document.getElementById() method where it Is appropriate. Also look at the getElementsByClassName() And getElementsByTagName() methods.

Parameters
NameTypeDescription
nameString

Required. The name attribute value of the element you want to access/manipulate

Returns

An HTMLCollection object, representing a collection of elements with the specified name. The elements in the returned collection are sorted as they appear in the source code.

method getElementsByTagName #
getElementsByTagName(String)

Get all elements in the document with the specified tag name

Remarks

The getElementsByTagName() method returns a collection of all elements in the document with the specified tag name, as an HTMLCollection object. The HTMLCollection Object represents a collection Of nodes. The nodes can be accessed by index numbers. The index starts at 0. Tip: The parametervalue "*" returns all elements In the document. Tip: You can use the length Property Of the HTMLCollection Object To determine the number Of elements With the specified tag name, Then you can Loop through all elements And extract the info you want.

Parameters
NameTypeDescription
tagnameString

Required. The tagname of the elements you want to get

Returns

An HTMLCollection object, representing a collection of elements with the specified tag name. The elements in the returned collection are sorted as they appear in the source code.

property TagName #
TagName

标签名

property Attributes #
Attributes

标签的属性列表

property Element #
Element(String)

get attribute value by attribute name

Parameters
NameTypeDescription
nameString

case insensitive

Returns

this property returns nothing if the attribute is not found from the current element node

property id #
id

唯一编号是区分大小写的

property class #
class
Remarks

multiple class could be assigned to a html node

field elementNodes #
elementNodes

当前的这个节点下面所拥有的子节点

field tagIndex #
tagIndex

大小写不敏感

field classIndex #
classIndex

** 大小写敏感

field nameIndex #
nameIndex

** 大小写敏感

field idIndex #
idIndex

** 大小写敏感

property HtmlElements #
HtmlElements
property IsPlantText #
IsPlantText
property name #
name
property OnlyInnerText #
OnlyInnerText
property IsEmpty #
IsEmpty
method hasAttribute #
hasAttribute(String)
method GetPlantText #
GetPlantText()
method Add #
method ToString #
ToString()
method GetAllChildsByNodeName #
GetAllChildsByNodeName(String)
method GetAllChilds #
GetAllChilds()
method GetHtmlText #
GetHtmlText()