Create a Visual Basic UWP project in Visual Studio.
In MainPage.xaml:
<Page
x:Class="HTML解析测试.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:HTML解析测试"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<TextBlock x:Name="Value"/>
</Page>
In MainPage.xaml.vb:
' https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x804 上介绍了“空白页”项模板
''' <summary>
''' 可用于自身或导航至 Frame 内部的空白页。
''' </summary>
Public NotInheritable Class MainPage
Inherits Page
Private Async Sub MainPage_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
Dim HtmlDocument As New Aspose.Html.HTMLDocument(Await (Await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(New Uri("ms-appx:///HTML文档.html"))).OpenStreamForReadAsync, "http://wj.shtc.cn")
Value.Text = DirectCast(HtmlDocument.GetElementById("__VIEWSTATE"), Aspose.Html.HTMLInputElement).Value
End Sub
End Class
This code should find the input element with ID “__VIEWSTATE” from the HTML text file and show its value. However, it run successfully only under Debug configuration. Aspose can’t find the element under Release configuration.
Visual Studio version:
Microsoft Visual Studio Community 2022 (64 位) - Preview
版本 17.3.0 Preview 1.1
Reproduce.zip (30.8 KB)