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. Other Discussions
  3. The Weird and The Wonderful
  4. String of Horror

String of Horror

Scheduled Pinned Locked Moved The Weird and The Wonderful
xml
4 Posts 4 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.
  • I Offline
    I Offline
    Izisin
    wrote on last edited by
    #1

    I asked a developer for code to create a specific XML document to save time. Here is what he sent. Needless to say, it didn't save me any time.

    Dim XMLFile As StreamWriter = New StreamWriter(strAssetFile, False)

      XMLFile.WriteLine("<Assets>")
      XMLFile.WriteLine("<Encoding>")
      XMLFile.WriteLine("<Profile Specifier=" + """" + "Standard1" + """" + ">")
      XMLFile.WriteLine("</Profile>")
      XMLFile.WriteLine("</Encoding>")
    
      XMLFile.WriteLine("<Asset FilePath=" + """" + strUpDestinationFile + """" \_
                             + " AssetID=" + """" + Movieid.ToString + """" \_
                               + " CustomerID=" + """" + "1129" + """" \_
                               + " AssetName=" + """" + strFileName.Substring(0, strFileName.LastIndexOf(".")).Replace("\_", " ") + """" \_
                               + " AssetDescription=" + """" + "Upolad" + """" \_
                               + " Category=" + """" + """" \_
                               + " FileNameToUse=" + """" + strFileName.Substring(0, strFileName.LastIndexOf(".")) + """" \_
                               + " Bytes=" + """" + (0).ToString + """" \_
                               + " Activate=" + """" + (1).ToString + """" \_
                               + " />")
      XMLFile.WriteLine("</Assets>")
    
      XMLFile.Close()
    
      CreateAssetXML = strAssetFile
    
    A J D 3 Replies Last reply
    0
    • I Izisin

      I asked a developer for code to create a specific XML document to save time. Here is what he sent. Needless to say, it didn't save me any time.

      Dim XMLFile As StreamWriter = New StreamWriter(strAssetFile, False)

        XMLFile.WriteLine("<Assets>")
        XMLFile.WriteLine("<Encoding>")
        XMLFile.WriteLine("<Profile Specifier=" + """" + "Standard1" + """" + ">")
        XMLFile.WriteLine("</Profile>")
        XMLFile.WriteLine("</Encoding>")
      
        XMLFile.WriteLine("<Asset FilePath=" + """" + strUpDestinationFile + """" \_
                               + " AssetID=" + """" + Movieid.ToString + """" \_
                                 + " CustomerID=" + """" + "1129" + """" \_
                                 + " AssetName=" + """" + strFileName.Substring(0, strFileName.LastIndexOf(".")).Replace("\_", " ") + """" \_
                                 + " AssetDescription=" + """" + "Upolad" + """" \_
                                 + " Category=" + """" + """" \_
                                 + " FileNameToUse=" + """" + strFileName.Substring(0, strFileName.LastIndexOf(".")) + """" \_
                                 + " Bytes=" + """" + (0).ToString + """" \_
                                 + " Activate=" + """" + (1).ToString + """" \_
                                 + " />")
        XMLFile.WriteLine("</Assets>")
      
        XMLFile.Close()
      
        CreateAssetXML = strAssetFile
      
      A Offline
      A Offline
      Adam Maras
      wrote on last edited by
      #2

      While I generally can't stand Visual Basic for much, it does certainly have some neat features for working with XML. You should send your developer a link to this article on MSDN[^].

      Adam Maras | Software Developer Microsoft Certified Professional Developer

      1 Reply Last reply
      0
      • I Izisin

        I asked a developer for code to create a specific XML document to save time. Here is what he sent. Needless to say, it didn't save me any time.

        Dim XMLFile As StreamWriter = New StreamWriter(strAssetFile, False)

          XMLFile.WriteLine("<Assets>")
          XMLFile.WriteLine("<Encoding>")
          XMLFile.WriteLine("<Profile Specifier=" + """" + "Standard1" + """" + ">")
          XMLFile.WriteLine("</Profile>")
          XMLFile.WriteLine("</Encoding>")
        
          XMLFile.WriteLine("<Asset FilePath=" + """" + strUpDestinationFile + """" \_
                                 + " AssetID=" + """" + Movieid.ToString + """" \_
                                   + " CustomerID=" + """" + "1129" + """" \_
                                   + " AssetName=" + """" + strFileName.Substring(0, strFileName.LastIndexOf(".")).Replace("\_", " ") + """" \_
                                   + " AssetDescription=" + """" + "Upolad" + """" \_
                                   + " Category=" + """" + """" \_
                                   + " FileNameToUse=" + """" + strFileName.Substring(0, strFileName.LastIndexOf(".")) + """" \_
                                   + " Bytes=" + """" + (0).ToString + """" \_
                                   + " Activate=" + """" + (1).ToString + """" \_
                                   + " />")
          XMLFile.WriteLine("</Assets>")
        
          XMLFile.Close()
        
          CreateAssetXML = strAssetFile
        
        J Offline
        J Offline
        Jaime Olivares
        wrote on last edited by
        #3

        Well, there are many horrors in that code. The longest line can be shortened 50% by using String.Format() Besides this, there is a high risk to produce a bad-formed XML if you have quotes, less-than or greater-than symbols inside your strings. XmlTextWriter is the proper class to do xml serialization.

        Best regards, Jaime.

        1 Reply Last reply
        0
        • I Izisin

          I asked a developer for code to create a specific XML document to save time. Here is what he sent. Needless to say, it didn't save me any time.

          Dim XMLFile As StreamWriter = New StreamWriter(strAssetFile, False)

            XMLFile.WriteLine("<Assets>")
            XMLFile.WriteLine("<Encoding>")
            XMLFile.WriteLine("<Profile Specifier=" + """" + "Standard1" + """" + ">")
            XMLFile.WriteLine("</Profile>")
            XMLFile.WriteLine("</Encoding>")
          
            XMLFile.WriteLine("<Asset FilePath=" + """" + strUpDestinationFile + """" \_
                                   + " AssetID=" + """" + Movieid.ToString + """" \_
                                     + " CustomerID=" + """" + "1129" + """" \_
                                     + " AssetName=" + """" + strFileName.Substring(0, strFileName.LastIndexOf(".")).Replace("\_", " ") + """" \_
                                     + " AssetDescription=" + """" + "Upolad" + """" \_
                                     + " Category=" + """" + """" \_
                                     + " FileNameToUse=" + """" + strFileName.Substring(0, strFileName.LastIndexOf(".")) + """" \_
                                     + " Bytes=" + """" + (0).ToString + """" \_
                                     + " Activate=" + """" + (1).ToString + """" \_
                                     + " />")
            XMLFile.WriteLine("</Assets>")
          
            XMLFile.Close()
          
            CreateAssetXML = strAssetFile
          
          D Offline
          D Offline
          dojohansen
          wrote on last edited by
          #4

          What feedback did you provide the developer...?

          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