如何在浏览器中搜索和显示XML文件

时间:2022-08-26 23:14:17

I'm looking for ways to display XML file in browser by using asp.net method.

我正在寻找使用asp.net方法在浏览器中显示XML文件的方法。

Below is the code that I'm using to search for any .XML file with the word "verify" as its title.

下面是我用来搜索任何.XML文件的代码,其中包含“verify”作为标题。

Now, I'm just wondering if there is a way to display the XML file in the web browser.

现在,我只是想知道是否有办法在Web浏览器中显示XML文件。

Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


    'To find subdirectories with a specific pattern/WILD CARD
    'ms-help://MS.VSExpressCC.v80/MS.NETFramework.v20.en/dv_vbcn/html/c9265fd1-7483-4150-8b7f-ff642caa939d.htm
    'Me.ListBox1.Items.Clear()
    Dim path As String = "\\g1w6223c\e$"
    Dim searchPattern As String = "*verify*.xml"
    For Each value As String In My.Computer.FileSystem.GetFiles(path, FileIO.SearchOption.SearchAllSubDirectories, searchPattern
                                                                )
        ListBox1.Items.Add(value)
        TextBox1.Text = "found"
    Next

End Sub

1 个解决方案

#1


0  

You can use Microsoft® Internet Explorer to view XML documents in the browser, just as you would view HTML pages. Unlike HTML, XML does not predefine display properties for specific elements. Therefore, XML requires a separate style sheet that specifies how the XML data should be displayed. This separation of XML content from its presentation allows the content to be easily repurposed. To view an XML file in Internet Explorer, you can specify a style sheet the following ways. Use the default style sheet, which presents the file as a collapsible tree. Specify a specific style sheet at the top of the XML file, in an href attribute such as the following: Specify any style sheet at the command prompt, for example: c:\bat\msxsl mydata.xml mytransform.xsl -o myoutput.html

您可以使用Microsoft®InternetExplorer在浏览器中查看XML文档,就像查看HTML页面一样。与HTML不同,XML不会预定义特定元素的显示属性。因此,XML需要一个单独的样式表,指定应如何显示XML数据。 XML内容与其呈现的这种分离允许容易地重新利用内容。要在Internet Explorer中查看XML文件,可以通过以下方式指定样式表。使用默认样式表,该表将文件显示为可折叠树。在XML文件顶部指定特定样式表,如下所示:在命令提示符下指定任何样式表,例如:c:\ bat \ msxsl mydata.xml mytransform.xsl -o myoutput。 HTML

#1


0  

You can use Microsoft® Internet Explorer to view XML documents in the browser, just as you would view HTML pages. Unlike HTML, XML does not predefine display properties for specific elements. Therefore, XML requires a separate style sheet that specifies how the XML data should be displayed. This separation of XML content from its presentation allows the content to be easily repurposed. To view an XML file in Internet Explorer, you can specify a style sheet the following ways. Use the default style sheet, which presents the file as a collapsible tree. Specify a specific style sheet at the top of the XML file, in an href attribute such as the following: Specify any style sheet at the command prompt, for example: c:\bat\msxsl mydata.xml mytransform.xsl -o myoutput.html

您可以使用Microsoft®InternetExplorer在浏览器中查看XML文档,就像查看HTML页面一样。与HTML不同,XML不会预定义特定元素的显示属性。因此,XML需要一个单独的样式表,指定应如何显示XML数据。 XML内容与其呈现的这种分离允许容易地重新利用内容。要在Internet Explorer中查看XML文件,可以通过以下方式指定样式表。使用默认样式表,该表将文件显示为可折叠树。在XML文件顶部指定特定样式表,如下所示:在命令提示符下指定任何样式表,例如:c:\ bat \ msxsl mydata.xml mytransform.xsl -o myoutput。 HTML