XMLDocument, SVG and BOM

GosthMan

New Member
I have an SQLite DB that holds different SVG images as BLOB.But, somehow, when that database was created, some of the images (as a XML dialect)have the Byte order mark at the beginning of the blob, actually it is EF BB BF in hex.To build proper images, i create a XMLDocument from that SVG, something like:\[code\]string svgFromSqlite = ///... load data from SQLite;XmlDocument document = new XmlDocument();document.LoadXml(svgFromSQlite);\[/code\]At the moment, i just remove the BOM with some really dirty hack:\[code\]// somewhere inside the loadFromDatabase function:if (!string.IsNullOrEmpty(svgData)){ int index = svgData.IndexOf("<"); if (index != 0) { svgData= http://stackoverflow.com/questions/11311260/svgData.Substring(index); }}\[/code\]Is there a way to let XMLDocument understand XML Data with AND without BOM.As mentioned, not all of the Database contained SVG files have that BOM.Any better ideas are highly appreciated!
 
Back
Top