* BUG: the parser now supports white spaces (http://www.w3.org/TR/REC-xml/#NT-S

git-svn-id: svn://localhost/gambas/trunk@4657 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Adrien Prokopowicz 2012-04-22 18:51:24 +00:00
parent d2a24bbec0
commit 828599ce9e
3 changed files with 20 additions and 1 deletions

View file

@ -364,14 +364,19 @@ vector<Node*>* Element::fromText(wstring data, wstring::size_type i, uint c, uin
attr += s;
INC;
}
while(i < data.length() && isWhiteSpace(s)) INC;
if(s != L"=")
{
i -= attr.length();
CLEAR
throw HTMLParseException(c, l, NEAR, L"Expected '=' after attribute name.");
}
INC;
while(i < data.length() && isWhiteSpace(s)) INC;
wstring delimiter = s;
if(delimiter != L"\"" && delimiter != L"'"){//Pas de délimiteur

View file

@ -180,6 +180,19 @@ bool isNameChar(wstring &s)
(car == 0xB7) || INTER(0x0300, 0x036F) || INTER(0x203F, 0x2040);
}
/* http://www.w3.org/TR/REC-xml/#NT-S
S ::= (#x20 | #x9 | #xD | #xA)+
*/
bool isWhiteSpace(wstring &s)
{
const wchar_t car = (s.at(0));
return (car == 0x20) || (car == 0x9) || (car == 0xD) || (car == 0xA);
}
#ifndef __HMAIN_CPP
GB_INTERFACE GB EXPORT;

View file

@ -66,6 +66,7 @@ extern "C" GB_INTERFACE GB;
bool isNameStartChar(wstring &s);
bool isNameChar(wstring &s);
bool isWhiteSpace(wstring &s);