Core: Fixed problems with recent XMLParse fix

This commit is contained in:
Mirek Fidler 2023-10-09 10:27:45 +02:00
parent 59f85cc823
commit 7bcf542718
4 changed files with 17 additions and 9 deletions

View file

@ -4,14 +4,14 @@
<META NAME="Generator" CONTENT="U++ HTML Package">
<TITLE>Test</TITLE>
<STYLE TYPE="text/css"><!--
.A{margin:0px 0px 16px 0px;text-indent:0px;text-align:left;color:#000000;font-family:serif;font-size:24pt;font-weight:bold;font-style:normal;text-decoration:none;}
.B{margin:16px 0px 0px 0px;text-indent:0px;text-align:left;color:#000000;font-family:sans-serif;font-size:16pt;font-weight:bold;font-style:normal;text-decoration:none;}
.C{margin:0px 0px 0px 0px;text-indent:0px;text-align:left;color:#000000;font-family:sans-serif;font-size:12pt;font-weight:normal;font-style:normal;text-decoration:none;}
.D{margin:8px 0px 8px 0px;text-indent:0px;text-align:left;color:#000000;font-family:sans-serif;font-size:10pt;font-weight:normal;font-style:normal;text-decoration:none;line-height:150%}
.A{margin:0px 0px 16px 0px;text-indent:0px;text-align:left;color:#000000;font-family:serif;font-size:24pt;font-weight:bold;font-style:normal;}
.B{margin:16px 0px 0px 0px;text-indent:0px;text-align:left;color:#000000;font-family:sans-serif;font-size:16pt;font-weight:bold;font-style:normal;}
.C{margin:0px 0px 0px 0px;text-indent:0px;text-align:left;color:#000000;font-family:sans-serif;font-size:12pt;font-weight:normal;font-style:normal;}
.D{margin:8px 0px 8px 0px;text-indent:0px;text-align:left;color:#000000;font-family:sans-serif;font-size:10pt;font-weight:normal;font-style:normal;line-height:150%}
.E{font-weight:bold;}
.F{margin:0px 0px 0px 0px;text-indent:0px;text-align:center;color:#000000;font-family:sans-serif;font-size:12pt;font-weight:normal;font-style:normal;text-decoration:none;}
.G{margin:0px 0px 0px 64px;text-indent:0px;text-align:left;color:#000080;font-family:monospace;font-size:8pt;font-weight:normal;font-style:normal;text-decoration:none;}
.H{margin:0px 0px 0px 64px;text-indent:0px;text-align:left;color:#1c7f00;font-family:monospace;font-size:8pt;font-weight:normal;font-style:normal;text-decoration:none;}
.F{margin:0px 0px 0px 0px;text-indent:0px;text-align:center;color:#000000;font-family:sans-serif;font-size:12pt;font-weight:normal;font-style:normal;}
.G{margin:0px 0px 0px 64px;text-indent:0px;text-align:left;color:#000080;font-family:monospace;font-size:8pt;font-weight:normal;font-style:normal;}
.H{margin:0px 0px 0px 64px;text-indent:0px;text-align:left;color:#1c7f00;font-family:monospace;font-size:8pt;font-weight:normal;font-style:normal;}
.I{color:#000080;}
.J{color:#1caa00;}

Binary file not shown.

View file

@ -1012,8 +1012,9 @@ static XmlNode sReadXmlNode(XmlParser& p, ParseXmlFilter *filter, dword style)
m.Shrink();
return m;
}
if(p.ReadText().GetCount() == 0) // skip empty text
throw XmlError("Unexpected text");
p.ReadText();
// if(p.ReadText().GetCount() == 0) // skip empty text
// throw XmlError("Unexpected text");
return m;
}
@ -1027,6 +1028,12 @@ XmlNode ParseXML(XmlParser& p, dword style, ParseXmlFilter *filter)
XmlNode n = sReadXmlNode(p, filter, style);
if(n.GetType() != XML_DOC) // tag was ignored
r.Add() = pick(n);
else {
if(p.IsRelaxed())
p.Skip();
else
throw XmlError("Unexpected text");
}
}
return r;
}

View file

@ -164,6 +164,7 @@ public:
int GetColumn() const { return GetColumn0() + 1; }
void Relaxed(bool b = true) { relaxed = b; }
bool IsRelaxed() const { return relaxed; }
void PreserveAllWhiteSpaces(bool b = true) { preserveall = b; }
void Raw(bool b = true) { raw = b; }