string openElementPrefix;
string openElementNS;
bool hasRoot = false;
+ bool isDocumentEntity = false;
Hashtable newAttributeNamespaces = new Hashtable ();
Hashtable userWrittenNamespaces = new Hashtable ();
StringBuilder cachedStringBuilder;
if (hasRoot)
throw new XmlException ("WriteStartDocument called twice.");
+ isDocumentEntity = true;
// CheckState ();
CheckOutputState ();
public override void WriteString (string text)
{
- if (ws == WriteState.Prolog)
- throw new InvalidOperationException ("Token content in state Prolog would result in an invalid XML document.");
+ switch (ws) {
+ case WriteState.Start:
+ case WriteState.Prolog:
+ if (isDocumentEntity)
+ throw new InvalidOperationException ("Token content in state Prolog would result in an invalid XML document.");
+ ws = WriteState.Content;
+ break;
+ }
WriteStringInternal (text, true);