File Path in XML


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: File Path in XML

  1. #1
    Join Date
    Apr 2004
    Posts
    134

    File Path in XML

    Hi all,

    I'm creating a progam in C# that reads a file location at start up and displays the parent folders in a combo box. This file location may change in future. So I intend to keep this in an xml file and allow the user to change it when needed. But how do I go about it? I have not done any coding with xml yet. So, please help.

    Thanks

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    An XML file is nothing more that a specially formatted text file.

    Have you worked with text files before?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  3. #3
    Join Date
    Apr 2004
    Posts
    134
    Not really! Could you help me out please?

  4. #4
    Join Date
    Jan 2009
    Posts
    6
    Check out these following links

    http://www.codeproject.com/KB/cpp/parsefilecode.aspx
    http://support.microsoft.com/kb/307548

    If you can provide more details as to the format of the file and the purpose of the app I might be able to help futher...what you have said is a bit vague and doesn't make a lot of sense to me!

  5. #5
    Join Date
    Apr 2004
    Posts
    134
    Quote Originally Posted by Hack View Post
    An XML file is nothing more that a specially formatted text file.

    Have you worked with text files before?
    Yes, I have worked. I came to know that the properties settings would do the job. But that too gives an error.

    I added 'ParentPath' in the Name field and "C:\Test" in the value field. But the error is 'Illegal characters in path.'

    Code:
    string path = Properties.Settings.Default.ParentPath.ToString();
    DirectoryInfo di = new DirectoryInfo(path);

  6. #6
    Join Date
    Jan 2009
    Posts
    6
    It sounds like you havent escaped the \

    \ is a special character and as such needs to be escaped using another \

    so use something like

    Code:
    string test = "C:\\test.txt"
    or

    Code:
    string test = @"C:\test.txt"

  7. #7
    Join Date
    Apr 2004
    Posts
    134
    Solved by removing the quotes.

Similar Threads

  1. XML files vs Database
    By Mansoor in forum XML
    Replies: 8
    Last Post: 08-23-2002, 05:35 PM
  2. File uploading / objFile.Write problem
    By Tomer Cagan in forum ASP.NET
    Replies: 1
    Last Post: 07-24-2001, 10:01 AM
  3. How do i search within a xml file?
    By Kelvin Teh in forum XML
    Replies: 3
    Last Post: 02-16-2001, 11:09 AM
  4. Display xml file
    By rana in forum XML
    Replies: 5
    Last Post: 12-10-2000, 12:50 AM
  5. Problem Converting ADO Recordset to XML
    By CHRISTOS STAVRINOU in forum VB Classic
    Replies: 0
    Last Post: 11-16-2000, 05:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center