Skip to content

Commit eaf9822

Browse files
committed
EvilBeaver#1586 Пропуск пробельных символов после служебных элементов XML.
1 parent 94a5c42 commit eaf9822

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

src/OneScript.StandardLibrary/Xml/XmlReaderImpl.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,16 @@ private void V8CompatibleSkip()
387387

388388
[ContextMethod("Прочитать", "Read")]
389389
public bool Read()
390+
{
391+
var readingDone = ReadInternal();
392+
if (readingDone && _reader.NodeType == XmlNodeType.XmlDeclaration && _settings.IgnoreXMLDeclaration)
393+
{
394+
readingDone = ReadInternal();
395+
}
396+
return readingDone;
397+
}
398+
399+
private bool ReadInternal()
390400
{
391401
if (_reader == null)
392402
return false;
@@ -396,6 +406,15 @@ public bool Read()
396406
_emptyElemReadState = EmptyElemCompabilityState.EmptyElementRead;
397407
return true;
398408
}
409+
else if (_reader.NodeType == XmlNodeType.XmlDeclaration || _reader.NodeType == XmlNodeType.DocumentType)
410+
{
411+
var readingDone = _reader.Read();
412+
while (readingDone && _reader.NodeType == XmlNodeType.Whitespace)
413+
{
414+
readingDone = _reader.Read();
415+
}
416+
return readingDone;
417+
}
399418
else
400419
{
401420
bool readingDone = _ignoreWSChanged ? ReadWhenStateChanged() : _reader.Read();

0 commit comments

Comments
 (0)