ZURINET
asked on
Loading byte data to an Xml Document
Dear all
Give the class below
I need a way to extract the Data from the DownloadFile class
and assign it or load the data to an xml document. See the code below for details
Somehow I need to achive this
using (MemoryStream baseMemStream = new MemoryStream(newDownLoadFi le.[k].dat a))
{
xmlDoc.Load(baseMemStream) ;
}
Thanks in Advance
Give the class below
I need a way to extract the Data from the DownloadFile class
and assign it or load the data to an xml document. See the code below for details
Somehow I need to achive this
using (MemoryStream baseMemStream = new MemoryStream(newDownLoadFi
{
xmlDoc.Load(baseMemStream)
}
Thanks in Advance
public class DownloadFile
{
public byte[] Data;
public String Filename;
}
DownloadFile[] newDownLoadFile = GetMyProtocol( String customerID, DateTime CreateDate,boolean SavedData );
Until now I have tried to assign the data to an xml document
XmlDocument myXmlDoc = new XmlDocument();
if (newDownLoadFile.Length > 0)
{
for (int k = 0; k < newDownLoadFile.Length; k++)
myXmlDoc.load = newDownLoadFile[k].Data); // this is not working I need a stream
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The error suggest that XML data that you get in byte array is not XML compliant.
BTW, at which line of code you get this error?
BTW, at which line of code you get this error?
ASKER
Sorry solved it with another solution
ASKER
Thanks for the feeback..
Tried it ... getting some erros.. (Root element is missing.)
Any Ideas.. Notwitstanding that I can use the code below to write it to file.. but need to a method that will retrun xml document..
ByteArrayToFile(pathNew + varIncrement, newDownLoadFile[k].Data);
Open in new window