private void ParseContents()
{
short i;
TokenizerStream stream = new TokenizerStream();
_t.GetTokens( stream, 2, false );
stream.Reset();
int gotoPosition = DetermineFormat( stream );
stream.GoToPosition( gotoPosition );
_t.GetTokens( stream, -1, false );
stream.Reset();
int neededIndex = 0;
GetRequiredSizes( stream, ref neededIndex );
_doc = new SecurityDocument( neededIndex );
int position = 0;
stream.Reset();
for (i = stream.GetNextFullToken(); i != -1; i = stream.GetNextFullToken())
{
if ((i & c_flag) != c_flag)
continue;
else
{
switch((short)(i & 0xFF00))
{
case c_elementtag:
_doc.AddToken( SecurityDocument.c_element, ref position );
_doc.AddString( stream.GetNextString(), ref position );
break;
case c_attributetag:
_doc.AddToken( SecurityDocument.c_attribute, ref position );
_doc.AddString( stream.GetNextString(), ref position );
_doc.AddString( stream.GetNextString(), ref position );
break;
case c_texttag:
_doc.AddToken( SecurityDocument.c_text, ref position );
_doc.AddString( stream.GetNextString(), ref position );
break;
case c_additionaltexttag:
_doc.AppendString( " ", ref position );
_doc.AppendString( stream.GetNextString(), ref position );
break;
case c_childrentag:
_doc.AddToken( SecurityDocument.c_children, ref position );
break;
case c_wastedstringtag:
stream.ThrowAwayNextString();
break;
default:
throw new XmlSyntaxException();
}
}
}
}