Author: jackson
Date: 2008-01-30 15:39:41 -0500 (Wed, 30 Jan 2008)
New Revision: 94416
Modified:
trunk/moon/src/ChangeLog
trunk/moon/src/xaml.cpp
Log:
* xaml.cpp: Strip leading whitespace from xaml files.
Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog 2008-01-30 20:24:02 UTC (rev 94415)
+++ trunk/moon/src/ChangeLog 2008-01-30 20:39:41 UTC (rev 94416)
@@ -1,5 +1,9 @@
2008-01-30 Jackson Harper <[EMAIL PROTECTED]>
+ * xaml.cpp: Strip leading whitespace from xaml files.
+
+2008-01-30 Jackson Harper <[EMAIL PROTECTED]>
+
* xaml.cpp: Handle more names for the default namespace.
2008-01-30 Jackson Harper <[EMAIL PROTECTED]>
Modified: trunk/moon/src/xaml.cpp
===================================================================
--- trunk/moon/src/xaml.cpp 2008-01-30 20:24:02 UTC (rev 94415)
+++ trunk/moon/src/xaml.cpp 2008-01-30 20:39:41 UTC (rev 94416)
@@ -1221,6 +1221,7 @@
bool is_utf16 = false;
bool is_utf32 = false;
bool is_le = false;
+ bool first_read = true;
gunichar2 bom;
int offset = 0;
@@ -1329,13 +1330,22 @@
offset = 0;
}
- if (!XML_Parse (p, utf8_buffer, len, len == 0)) {
+ int ws = 0;
+ if (first_read) {
+ // Remove preceding white space
+ while (utf8_buffer [ws] && isspace (utf8_buffer [ws]))
+ ws++;
+ }
+
+ if (!XML_Parse (p, utf8_buffer + ws, len - ws, len == 0)) {
expat_parser_error (parser_info, XML_GetErrorCode (p));
goto cleanup_and_return;
}
if (converted)
g_free (converted);
+
+ first_read = false;
}
#ifdef DEBUG_XAML
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches