'remove BOM if present http://unicode.org/faq/utf_bom.html If (Len(Trim(fileContent)) > 0) Then Dim AscValue : AscValue = Asc(Trim(fileContent)) If ((AscValue = -15441) Or (AscValue = 239)) Then : fileContent = Mid(Trim(fileContent),4) : End If End If
XmlException: The data at the root level is invalid. Line 1, position 1.
This might be a really obscure (or dumb?) ASP.NET / C# problem, but again I thought I'd post something about it in case it helps someone else searching about this issue....
I was getting an exception when loading an XML file:
Error with ... xml\nav.xml: System.Xml.XmlException: The data at the root level is invalid. Line 1, position 1. at System.Xml.XmlTextReader.ParseRoot() at System.Xml.XmlTextReader.Read() at System.Xml.XmlValidatingReader.ReadWithCollectTextToken() at System.Xml.XmlValidatingReader.Read() at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) at System.Xml.XmlDocument.Load(XmlReader reader) at System.Xml.XmlDocument.LoadXml(String xml)
This is a bookmarklet I wrote up for my own use since I wasn't able to find something that performs a similar function (probably there IS something out there, I just wasn't able to find it in a short amount of time 🙂... It's really for the purposes of web development (well that's why I made it at least) when you either need to show or print out all the options that are available in a web page form drop-down (select) list. I'm sharing it here in case it can help someone else but I cannot, of course, provide any support (help getting it to work) or guarantees about it at all - use at your own "risk", figure it out on your own time, etc. etc.
Thanks to what is now commonly known as blog "comment spam", I had shut my blog comments off last November for several months until I could take the time to figure out how I wanted to "deal" with it… at least until MovableType 3 comes out.
After recently doing some searching, and since my amount of comment traffic is not extremely high, I decided I’d love to have both Jay Allen’s wonderful MT Blacklist plugin as well as the Scriptygoddess "Coment Queue" idea (however I had to use David Raynes’ perl version because I am not running MySQL). I soon realized though that, by default, these two plugins/hacks might not necessarily "play together" too well…. but I was determined! This is an explanation of the basic steps and MT "hacks" I peformed to get MT Blacklist and the Comment Queue hack (and then later the MT Notifier plugin – see further down in the entry) (apparently) working on my blogs. Some of the comment spam still occasionally slips by MT Blacklist, but thanks to the comment queue, it will never see the light of day on this site.
This is some technical/web development stuff… I am just posting it up here in case it can help anyone who comes across it down the road.