locked
XElement.Load not working RRS feed

  • Question

  • User-2089506584 posted

    Hello,

    I have this module app and the xelement.load is buggy. It does not correctly map the file. Why?

                    Dim store = From c In XElement.Load("App_Data/xml_path/shoe_data.xml").Elements("shoes")
                      Select c

    Error "Could not find file 'C:\Users\UserName\Documents\Visual Studio 2010\Projects\Module1\bin\Debug\App_Data\xml_path\shoe_data.xml'."

    The error states that it cannot find the xml file under the bin/Debug folder but the file resides in the root project.

    Thank You

    Thursday, April 19, 2012 2:56 AM

Answers

  • User181256233 posted

    You need to use XDocument.Load() instead of XElement. And also use Server.MapMap("~/App_Data/xml_path/shoe_data.xml") as the path

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 19, 2012 2:58 AM

All replies

  • User181256233 posted

    You need to use XDocument.Load() instead of XElement. And also use Server.MapMap("~/App_Data/xml_path/shoe_data.xml") as the path

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 19, 2012 2:58 AM
  • User1320101480 posted
    "~/App_Data/xml_path/shoe_data.xml"

    Thursday, April 19, 2012 3:02 AM