From 15ef4654121565f2c46c90e6d84e31f353bbefa0 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Sun, 13 Jul 2014 08:47:23 +0000 Subject: [PATCH] Fix for text parsing when the text object has properties git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@76898 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 a47b71691e..560d25a424 100644 --- a/src/richtext/richtextxml.cpp +++ b/src/richtext/richtextxml.cpp @@ -427,6 +427,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 ||