private DTDEntityDeclaration ReadEntityDecl ()
{
DTDEntityDeclaration decl = new DTDEntityDeclaration (DTD);
decl.BaseURI = BaseURI;
decl.XmlResolver = DTD.Resolver;
decl.IsInternalSubset = this.processingInternalSubset;
TryExpandPERef ();
decl.Name = ReadName ();
if (!SkipWhitespace ())
throw NotWFError ("Whitespace is required between name and content in DTD entity declaration.");
TryExpandPERef ();
if (PeekChar () == 'S' || PeekChar () == 'P') {
// external entity
ReadExternalID ();
decl.PublicId = cachedPublicId;
decl.SystemId = cachedSystemId;
if (SkipWhitespace ()) {
if (PeekChar () == 'N') {
// NDataDecl
Expect ("NDATA");
if (!SkipWhitespace ())
throw NotWFError ("Whitespace is required after NDATA.");
decl.NotationName = ReadName (); // ndata_name
}
}
if (decl.NotationName == null) {
decl.Resolve ();
ResolveExternalEntityReplacementText (decl);
} else {
// Unparsed entity.
decl.LiteralEntityValue = String.Empty;
decl.ReplacementText = String.Empty;
}
}
else {
// literal entity
ReadEntityValueDecl (decl);
ResolveInternalEntityReplacementText (decl);
}
SkipWhitespace ();
// This expanding is only allowed as a non-validating parser.
TryExpandPERef ();
Expect ('>');
return decl;
}