Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Web/Sgml
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv909/src/Adapdev.Web/Sgml
Added Files:
SgmlParser.cs SgmlReader.cs
Log Message:
--- NEW FILE: SgmlReader.cs ---
// Original Copyright (c) 2002 Microsoft Corporation. All rights reserved. - http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=B90FDDCE-E60D-43F8-A5C4-C3BD760564BC
/*
*
* An XmlReader implementation for loading SGML (including HTML) converting it
* to well formed XML, by adding missing quotes, empty attribute values, ignoring
* duplicate attributes, case folding on tag names, adding missing closing tags
* based on SGML DTD information, and so on.
*
* Copyright (c) 2002 Microsoft Corporation. All rights reserved.
*
* Chris Lovett
*
*/
using System;
using System.Xml;
using System.IO;
using System.Collections;
using System.Text;
[...1580 lines suppressed...]
// e.g. p not allowed inside p, not an interesting error.
} else {
string closing = "";
for (int k = top; k >= i+1; k--) {
if (closing != "") closing += ",";
Node n2 = (Node)this.stack[k];
closing += "<"+n2.Name+">";
}
Log("Element '{0}' not allowed inside '{1}', closing {2}.",
name, n.Name, closing);
}
this.state = State.AutoClose;
this.newnode = node;
Pop(); // save this new node until we pop the others
this.poptodepth = i+1;
}
}
}
}
}
--- NEW FILE: SgmlParser.cs ---
// Original Copyright (c) 2002 Microsoft Corporation. All rights reserved. - http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=B90FDDCE-E60D-43F8-A5C4-C3BD760564BC
/*
*
* An XmlReader implementation for loading SGML (including HTML) converting it
* to well formed XML, by adding missing quotes, empty attribute values, ignoring
* duplicate attributes, case folding on tag names, adding missing closing tags
* based on SGML DTD information, and so on.
*
* Copyright (c) 2002 Microsoft Corporation. All rights reserved.
*
* Chris Lovett
*
*/
using System;
using System.IO;
using System.Collections;
using System.Text;
using System.Net;
[...2012 lines suppressed...]
if (hasdef)
{
if (ch == '\'' || ch == '"')
{
string lit = this.current.ScanLiteral(this.sb, ch);
attdef.Default = lit;
ch = this.current.SkipWhitespace();
}
else
{
string name = this.current.ScanToken(this.sb, SgmlDtd.WhiteSpace, false);
name = name.ToUpper();
name = this.nameTable.Add(name);
attdef.Default = name; // bugbug - must be one of the enumerated names.
ch = this.current.SkipWhitespace();
}
}
}
}
}
|