{"id":3870,"date":"2014-03-30T06:08:56","date_gmt":"2014-03-30T06:08:56","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/flex-error-message-about-well-formed-markup-even-though-xml-is-well-formed-collection-of-common-programming-errors\/"},"modified":"2014-03-30T06:08:56","modified_gmt":"2014-03-30T06:08:56","slug":"flex-error-message-about-well-formed-markup-even-though-xml-is-well-formed-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/flex-error-message-about-well-formed-markup-even-though-xml-is-well-formed-collection-of-common-programming-errors\/","title":{"rendered":"Flex: Error message about &ldquo;well-formed&rdquo; markup, even though XML is well-formed-Collection of common programming errors"},"content":{"rendered":"<p>The solution to this particular problem for me was that there was an unnecessary Byte Order Mark at the very beginning of the file, which I had to remove. Upon inspecting the file with a hex editor, I saw the following as the leading bytes in the file:<\/p>\n<blockquote>\n<p>EF BB BF<\/p>\n<\/blockquote>\n<p>The Flash Player 9 runtime apparently has a problem with this Byte Order Mark on a UTF-8 file, which is unnecessary since there is no byte ordering in UTF-8, as opposed to UTF-16 and UTF-32. Flash Player 10 has no problem with this leading Byte Order Mark.<\/p>\n<p>That explains, why this other blog entry documents that the following solution worked for them:<\/p>\n<pre><code>xmlString = xmlString.substr(1);\n<\/code><\/pre>\n<p>That particular solution didn&#8217;t quite work for me, since it shifted the runtime error to Flash Player 10 users, instead of Flash Player 9 users. Since we had control of the XML input, we could simply modify that, but if the XML came from a source we didn&#8217;t control, I suppose we could have tested the ByteArray for the leading BOM, and skipped it as shown above.<\/p>\n<p>Several blog entries were helpful in confirming that the BOM was the problem, such as this entry, in which a commenter states that his solution to the same 1088 runtime error was:<\/p>\n<blockquote>\n<p>For me the problem was XML saved in UTF with BOM.<\/p>\n<\/blockquote>\n<p>Also, this other blog entry provided more confirmation of the same problem occurring in Java:<\/p>\n<blockquote>\n<p>When dealing with a UTF-8 encoded RSS feed, this three-byte pattern (0xEF 0xBB 0xBF) in &gt;the prolog can cause all sorts of interesting XML parsing problems<\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>The solution to this particular problem for me was that there was an unnecessary Byte Order Mark at the very beginning of the file, which I had to remove. Upon inspecting the file with a hex editor, I saw the following as the leading bytes in the file: EF BB BF The Flash Player 9 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3870","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3870","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3870"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3870\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3870"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3870"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3870"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}