PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
New WINDEV, WEBDEV and WINDEV Mobile 26 feature!
  • Properties specific to the description of htmlNode variables
  • WLanguage functions that manipulate htmlNode variables
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
htmlNode (Type of variable)
In french: htmlNoeud
The htmlNode type is used to define all the advanced characteristics of a node of an HTML document. The characteristics of this node can be defined and modified using different WLanguage properties.
Remark: See Declaring a variable for more details on the declaration of this type of variable and the use of WLanguage properties.
Example
d is htmlDocument
e is htmlNode
e.TagName = "H1"
e.Text = "Title"
d.html.body.Add(e)
Remarks

Properties specific to the description of htmlNode variables

The following properties can be used to manipulate a node of an HTML document:
Property nameType usedEffect
AttributeArray of htmlAttributeAttributes of an htmlNodeElement node.
ExistBoolean
  • True if the node exists in the document,
  • False otherwise.
This property is read-only.
OuterHTMLCharacter stringCorresponds to the HTML code of the current node and its descendants.
This property is read-only.
InnerHTMLCharacter stringCorresponds to the HTML code of the descendants of the current node.
ChildNodeArray of htmlNode variablesChild node of an htmlNodeElement node.
TagNameCharacter stringName of the tag if the node is an htmlNodeElement node, empty string ("") otherwise.
CountIntegerNumber of elements with the same name.
This property is read-only.
ParenthtmlNode variableParent node, NULL if the node is the root.
This property is read-only.
TextCharacter stringContents of the node encoded in the current character set.
  • If the node is of type htmlNodeText, htmlNodeComment or htmlNodeCDATA, the property returns and modifies the node.
  • If the node is of type htmlNodeElement, the property returns the concatenation of the text of all subnodes.
When a value is assigned to the property, it empties the subnodes and replaces them with a text subnode containing that value.
TypeInteger constantType of node:
  • htmlNodeComment: Comment node.
  • htmlNodeCDATA: CDATA Node (XHTML compatibility).
  • htmlNodeElement: Element node, HTML tag.
  • htmlNodeTexte: Text node.
The following operators are available for htmlNodeElement nodes:
  • "." operator: The "." operator is used to access sub-elements by tag name.
  • ":" operator: The ":" operator is used to access attributes by name.
  • [ <index> ] operator: This operator is used to access sibling sub-elements of the same name by index.
  • [ <name> ] operator: This operator is used to access sub-elements by tag name.
htmlNodeElement nodes can contain subnodes.
"FOR EACH x OF NodeVariable" is used to loop through all the subnodes.
"FOR EACH x OF NodeVariable IN-DEPTH" is used to recursively loop through all the subnodes.

WLanguage functions that manipulate htmlNode variables

Versions 26 and later
HTMLFindElementByClass
New in version 26
HTMLFindElementByClass
HTMLFindElementByClass
Searches for elements whose "class" attribute matches a specific value in an HTML document (or in an HTML node).
Versions 26 and later
HTMLFindElementById
New in version 26
HTMLFindElementById
HTMLFindElementById
Searches for the element whose "Id" attribute matches a specific value in an HTML document (or in an HTML node).
Versions 26 and later
HTMLFindElementByName
New in version 26
HTMLFindElementByName
HTMLFindElementByName
Searches for elements whose "name" attribute matches a specific value in an HTML document (or in an HTML node).
Versions 26 and later
HTMLFindElementByTag
New in version 26
HTMLFindElementByTag
HTMLFindElementByTag
Searches for elements that correspond to a tag in an HTML document (or an HTML node).
Related Examples:
HTML types (HTMLDocument, HTMLNode, HTMLAttribute) Unit examples (WINDEV): HTML types (HTMLDocument, HTMLNode, HTMLAttribute)
[ + ] This example shows how to use the HTMLXxx WLanguage types (HTMLDocument, HTMLNode, HTMLAttribute)
WD HTML Export Training (WINDEV): WD HTML Export
[ + ] This example explains how to export data in HTML format with the WLanguage functions.
The following topics are presented in this example:
1/ the functions for managing the external files for generating the HTML file
2/ the operations performed on the HTML tags
3/ the generation of an HTML report
The generation of an HTML page is performed from the data found in a memory table.
By programming
The principle consists in generating a text file with a "HTM" extension. The WLanguage function named "fWrite" will be used.
This example easily writes the text strings by respecting the syntax of the HTML language.
Automatically
The principle consists in creating a report on table based on the memory table that was previously filled.
The printout is requested with an HTML output.
WD HTML Page Import Sample components (WINDEV): WD HTML Page Import
[ + ] This example explains how HTML pages can be imported with the WLanguage functions.
The following topics are presented in this example:
1/ how to import an object found on a Web site
2/ how to analyze an HTML file
Summary of the example supplied with WINDEV:
This example is used to save locally an HTML page found on a Web site.
This page is analyzed in order to import all its dependencies (images, applets, and so on). This example is not a Web grabber. It can only be used to download the pages one by one.
The principle used in this example can also be used to retrieve informations from pages whose format is recognized (example: daily retrieval of share values)
Minimum version required
  • Version 26
This page is also available for…
Comments
Click [Add] to post a comment