fixed parsing of CDATA elements (<script> and <style>) (Bill Nalen)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19287 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2003-02-23 18:59:13 +00:00
parent 749caeeb38
commit 7c6cd4a86b
2 changed files with 59 additions and 0 deletions

View File

@@ -127,6 +127,8 @@ void wxHtmlParser::CreateDOMTree()
m_CurTextPiece = 0;
}
extern bool wxIsCDATAElement(const wxChar *tag);
void wxHtmlParser::CreateDOMSubTree(wxHtmlTag *cur,
int begin_pos, int end_pos,
wxHtmlTagsCache *cache)
@@ -137,6 +139,15 @@ void wxHtmlParser::CreateDOMSubTree(wxHtmlTag *cur,
int i = begin_pos;
int textBeginning = begin_pos;
// If the tag contains CDATA text, we include the text between beginning
// and ending tag verbosely. Setting i=end_pos will skip to the very
// end of this function where text piece is added, bypassing any child
// tags parsing (CDATA element can't have child elements by definition):
if (cur != NULL && wxIsCDATAElement(cur->GetName().c_str()))
{
i = end_pos;
}
while (i < end_pos)
{
c = m_Source.GetChar(i);
@@ -209,6 +220,7 @@ void wxHtmlParser::CreateDOMSubTree(wxHtmlTag *cur,
}
else
i = chd->GetBeginPos();
textBeginning = i;
}