From aee4a52e64751701080e17925dcc03871e307b4e Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Sun, 13 Jul 2014 08:47:41 +0000 Subject: [PATCH] Fix for text parsing when the text object has properties git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76899 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/richtext/richtextxml.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/richtext/richtextxml.cpp b/src/richtext/richtextxml.cpp index 2f8925fc57..6660faf5aa 100644 --- a/src/richtext/richtextxml.cpp +++ b/src/richtext/richtextxml.cpp @@ -423,6 +423,38 @@ bool wxRichTextPlainText::ImportFromXML(wxRichTextBuffer* buffer, wxXmlNode* nod { wxString text; wxXmlNode* textChild = node->GetChildren(); + + // First skip past properties, if any. + wxXmlNode* n = textChild; + while (n) + { + // Skip past properties + if ((n->GetType() == wxXML_ELEMENT_NODE) && n->GetName() == wxT("properties")) + { + textChild = n->GetNext(); + n = NULL; + + // Skip past the whitespace after the properties + while (textChild && (textChild->GetType() == wxXML_TEXT_NODE)) + { + wxString text = textChild->GetContent(); + text.Trim(true); + text.Trim(false); + if (!text.IsEmpty()) + { + textChild->SetContent(text); + break; + } + else + textChild = textChild->GetNext(); + } + + break; + } + if (n) + n = n->GetNext(); + } + while (textChild) { if (textChild->GetType() == wxXML_TEXT_NODE ||