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. Sending XML

Sending XML

Scheduled Pinned Locked Moved C#
htmlxml
4 Posts 2 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.
  • R Offline
    R Offline
    rakeshs312
    wrote on last edited by
    #1

    Hi all, Is it possible to call a function with sending a XML file as XML DOM object.The XML is corrupted(means it contains special characters and will not open in internet explorer) code is something like this XmlDocument xmlDoc = new XmlDocument(); -------------------------------- -------------------------------- -------------------------------- xmlDoc.save(path+filename) bool uploadstatus= functionName(xmlDoc); public bool functionName(XmlDocument XmlDocToUpload)//is not calling { ---- ---- ---- } Thanks in advance

    F 1 Reply Last reply
    0
    • R rakeshs312

      Hi all, Is it possible to call a function with sending a XML file as XML DOM object.The XML is corrupted(means it contains special characters and will not open in internet explorer) code is something like this XmlDocument xmlDoc = new XmlDocument(); -------------------------------- -------------------------------- -------------------------------- xmlDoc.save(path+filename) bool uploadstatus= functionName(xmlDoc); public bool functionName(XmlDocument XmlDocToUpload)//is not calling { ---- ---- ---- } Thanks in advance

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

      hi rakeshs312, the example you wrote above is possible, you can't send objects direct over tcp or serial port. you need to get the byte of the XmlDocument. In your case you have special characters, so you need to convert these character to UTF-8 charset. (IE doesn't show it because the secial characters are not correct encoded!) take a look at the HTML characters so an open breaked character '<' is in the inner xml not an '<' it would be written as &#139 if you write ÄÖÜ in xml you have the same problem, IE can show this, but the encoding is wrong either. to solve get the hole Xml from the document as string and convert it to an UTF-8 string or byte array. hope i could help you bless :)

      R 1 Reply Last reply
      0
      • F freakyit

        hi rakeshs312, the example you wrote above is possible, you can't send objects direct over tcp or serial port. you need to get the byte of the XmlDocument. In your case you have special characters, so you need to convert these character to UTF-8 charset. (IE doesn't show it because the secial characters are not correct encoded!) take a look at the HTML characters so an open breaked character '<' is in the inner xml not an '<' it would be written as &#139 if you write ÄÖÜ in xml you have the same problem, IE can show this, but the encoding is wrong either. to solve get the hole Xml from the document as string and convert it to an UTF-8 string or byte array. hope i could help you bless :)

        R Offline
        R Offline
        rakeshs312
        wrote on last edited by
        #3

        Thanks rootjumper

        F 1 Reply Last reply
        0
        • R rakeshs312

          Thanks rootjumper

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

          here take a look at System.Web.HttpUtility.HtmlEncode(data) need the System.Web reference!

          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