summaryrefslogtreecommitdiff
path: root/packages/fcl-xml
diff options
context:
space:
mode:
authorsergei <sergei@3ad0048d-3df7-0310-abae-a5850022a9f2>2010-09-30 15:30:49 +0000
committersergei <sergei@3ad0048d-3df7-0310-abae-a5850022a9f2>2010-09-30 15:30:49 +0000
commitd4c36b09fef352020532acbcb8e4a7d58ed40c69 (patch)
tree7d600ededef81e98b14bedea409b2692d8a00a12 /packages/fcl-xml
parentd838f61556a90834fe396099fe03c29a810c6e76 (diff)
downloadfpc-d4c36b09fef352020532acbcb8e4a7d58ed40c69.tar.gz
* xmlread.pp, a bit better separation of DOM-specific and DOM-independent code in ParseComment() and ParsePI().
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@16070 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/fcl-xml')
-rw-r--r--packages/fcl-xml/src/xmlread.pp43
1 files changed, 20 insertions, 23 deletions
diff --git a/packages/fcl-xml/src/xmlread.pp b/packages/fcl-xml/src/xmlread.pp
index 4b23f72328..296f3e8ee9 100644
--- a/packages/fcl-xml/src/xmlread.pp
+++ b/packages/fcl-xml/src/xmlread.pp
@@ -1892,14 +1892,12 @@ var
begin
ExpectString('--');
SaveLength := FValue.Length;
- if SkipUntilSeq([#0, '-'], '-') then
- begin
- ExpectChar('>');
- DoComment(@FValue.Buffer[SaveLength], FValue.Length-SaveLength);
- FValue.Length := SaveLength;
- end
- else
+ if not SkipUntilSeq([#0, '-'], '-') then
FatalError('Unterminated comment', -1);
+ ExpectChar('>');
+
+ DoComment(@FValue.Buffer[SaveLength], FValue.Length-SaveLength);
+ FValue.Length := SaveLength;
end;
procedure TXMLReader.ParsePI; // [16]
@@ -1908,7 +1906,7 @@ var
PINode: TDOMProcessingInstruction;
begin
FSource.NextChar; // skip '?'
- Name := ExpectName;
+ CheckName;
CheckNCName;
with FName do
if (Length = 3) and
@@ -1916,7 +1914,7 @@ begin
((Buffer[1] = 'M') or (Buffer[1] = 'm')) and
((Buffer[2] = 'L') or (Buffer[2] = 'l')) then
begin
- if Name <> 'xml' then
+ if not BufEquals(FName, 'xml') then
FatalError('''xml'' is a reserved word; it must be lowercase', FName.Length)
else
FatalError('XML declaration is not allowed here', FName.Length);
@@ -1926,21 +1924,20 @@ begin
SkipS(True);
FValue.Length := 0;
- if SkipUntilSeq(GT_Delim, '?') then
- begin
- SetString(Value, FValue.Buffer, FValue.Length);
- // SAX: ContentHandler.ProcessingInstruction(Name, Value);
- if FCurrContentType = ctEmpty then
- ValidationError('Processing instructions are not allowed within EMPTY elements', []);
-
- PINode := Doc.CreateProcessingInstruction(Name, Value);
- if Assigned(FCursor) then
- FCursor.AppendChild(PINode)
- else // to comply with certain tests, insert PI from DTD before DTD
- Doc.InsertBefore(PINode, FDocType);
- end
- else
+ if not SkipUntilSeq(GT_Delim, '?') then
FatalError('Unterminated processing instruction', -1);
+
+ SetString(Name, FName.Buffer, FName.Length);
+ SetString(Value, FValue.Buffer, FValue.Length);
+ // SAX: ContentHandler.ProcessingInstruction(Name, Value);
+ if FCurrContentType = ctEmpty then
+ ValidationError('Processing instructions are not allowed within EMPTY elements', []);
+
+ PINode := Doc.CreateProcessingInstruction(Name, Value);
+ if Assigned(FCursor) then
+ FCursor.AppendChild(PINode)
+ else // to comply with certain tests, insert PI from DTD before DTD
+ Doc.InsertBefore(PINode, FDocType);
end;
const