Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. XmlDocument.Save() throws expection when file name is containing colon ":".

XmlDocument.Save() throws expection when file name is containing colon ":".

Scheduled Pinned Locked Moved C#
question
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Piyush Vaishnav
    wrote on last edited by
    #1

    Hi... I am getting NotSupportedException "The given path's format is not supported." XmlDocumentObject.Save(filename); filename is "L:PROT", because it contains colon that's why exception is coming. Is there any alternative to use : in filename which could be saved in XmlDocument? Thanks in Advance.. Piyush

    P F 2 Replies Last reply
    0
    • P Piyush Vaishnav

      Hi... I am getting NotSupportedException "The given path's format is not supported." XmlDocumentObject.Save(filename); filename is "L:PROT", because it contains colon that's why exception is coming. Is there any alternative to use : in filename which could be saved in XmlDocument? Thanks in Advance.. Piyush

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      There are certain characters and filenames (such as CON or PRN) that you can't use when writing out a file. The : is used as a part of path identification, so is unavailable. You need to remove this colon.

      "WPF has many lovers. It's a veritable porn star!" - Josh Smith

      As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

      My blog | My articles | MoXAML PowerToys | Onyx

      1 Reply Last reply
      0
      • P Piyush Vaishnav

        Hi... I am getting NotSupportedException "The given path's format is not supported." XmlDocumentObject.Save(filename); filename is "L:PROT", because it contains colon that's why exception is coming. Is there any alternative to use : in filename which could be saved in XmlDocument? Thanks in Advance.. Piyush

        F Offline
        F Offline
        freakyit
        wrote on last edited by
        #3

        hi, System.IO.Path.InvalidPathChars will return a char array contianing the platform specfic characters that cannot be specified in path string. -> compare your characters against the invalid chars to determinate that your path is valid or not.. greetz :)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups