Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
改为从文件中读取;因此,我演示了如何使用System.Xml.Linq.XDocument.Parse加载XDocument。我想使我的示例简洁,但要包含实际的XML,这样它就可以成为一个完全有效的示例。 ' this gets the value of _Xml_Vb.net_Linq_Linq To Xml - Fatal编程技术网

改为从文件中读取;因此,我演示了如何使用System.Xml.Linq.XDocument.Parse加载XDocument。我想使我的示例简洁,但要包含实际的XML,这样它就可以成为一个完全有效的示例。 ' this gets the value of

改为从文件中读取;因此,我演示了如何使用System.Xml.Linq.XDocument.Parse加载XDocument。我想使我的示例简洁,但要包含实际的XML,这样它就可以成为一个完全有效的示例。 ' this gets the value of ,xml,vb.net,linq,linq-to-xml,Xml,Vb.net,Linq,Linq To Xml,改为从文件中读取;因此,我演示了如何使用System.Xml.Linq.XDocument.Parse加载XDocument。我想使我的示例简洁,但要包含实际的XML,这样它就可以成为一个完全有效的示例。 ' this gets the value of the price element within a product product.<Price>.Value Public Class Product Property Description As String

改为从文件中读取;因此,我演示了如何使用System.Xml.Linq.XDocument.Parse加载XDocument。我想使我的示例简洁,但要包含实际的XML,这样它就可以成为一个完全有效的示例。
' this gets the value of the price element within a product
product.<Price>.Value
Public Class Product
    Property Description As String
    Property Price As Double

    Public Shared Function FromXml(serverPath As String) As IEnumerable(Of Product)

       Using fs = IO.File.OpenRead(serverPath)
           Dim p As New Product
           Return New XmlSerializer(p.GetType).Deserialize(fs)
       End Using

    End Function

End Class
dim listOfProducts = Product.FromXml(Server.MapPath("~/App_Data/products.xml"))