![]() |
| |||||||
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 |
| Registered User Join Date: Nov 2005
Posts: 41
| The data should be ok. It starts like: <?xml version= ...... Code: System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
byte[] bytesin = encoding.GetBytes(msgin);
ProtocolHeader protocolHdr = ProtocolHeader.ReadProtocolHeader(bytesin, 0, msgin.Length);
MemoryStream hdrin = new MemoryStream(bytesin, Convert.ToInt16(protocolHdr.ProtocolHeaderSize), msgin.Length - Convert.ToInt16(protocolHdr.ProtocolHeaderSize));
XmlReaderSettings xmlReaderSettings = new XmlReaderSettings();
xmlReaderSettings.IgnoreWhitespace = true;
XmlReader msginReader = XmlReader.Create(hdrin, xmlReaderSettings);
while (msginReader.Read())
{
// ...
}
|
| mdoland is offline | |
| | #2 |
| and the hat of Jobseeking Join Date: Aug 2001 Location: The edge of the known universe
Posts: 21,676
| Perhaps it isn't an ASCII file at all, and it ran into this at the start of the file. http://en.wikipedia.org/wiki/Byte_Order_Mark |
| Salem is offline | |
| | #3 |
| Registered User Join Date: Nov 2005
Posts: 41
| Hmm, slightly embarassed. I think I found the error. I started one character to late. I skipped the <. Thank you anyway. Sometimes one just have to express the problem to realize what actually is the bug. |
| mdoland is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Bitmasking Problem | mike_g | C++ Programming | 13 | 11-08-2007 12:24 AM |
| Button handler | Nephiroth | Windows Programming | 8 | 03-12-2006 06:23 AM |
| Templated Binary Tree... dear god... | Nakeerb | C++ Programming | 15 | 01-17-2003 02:24 AM |
| Contest Results - May 27, 2002 | ygfperson | A Brief History of Cprogramming.com | 18 | 06-18-2002 01:27 PM |
| Greenhand want help! | leereg | C Programming | 6 | 01-29-2002 06:04 AM |