Skip to content

Consider Get-PSHTMLDocument #250

@Stephanevg

Description

@Stephanevg

It would be nice to have a function which could read a HTML page out, and send an object back, which could be developed further, or even converted to an PSHTML Powershell file (is that utopic?)

  1. The parsing

For that, we will need the ability to parse a HTML document.

This snippet might be an option to do so:

Add-Type -AssemblyName System.Xml.Linq
$txt=[IO.File]::ReadAllText("c:\myhtml.html")
$xml = [System.Xml.Linq.XDocument]::Parse($txt)
$ns='http://www.w3.org/1999/xhtml'
$divs=$cells = $xml.Descendants("{$ns}td")
  1. Create a PSHTML.Document object
    Once it is parsed (or while parsing) we could create for each html element the corrsponding PSHTML Object.
    This would assume that this issue is closed and implemented first -> Create core PSHTML object (PSHTML.Document) #218

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions