Sending XML
-
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
-
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
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 ‹ 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 :)
-
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 ‹ 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 :)
Thanks rootjumper
-
Thanks rootjumper
here take a look at System.Web.HttpUtility.HtmlEncode(data) need the System.Web reference!