本文整理汇总了C#中TidyNet.Lexer.FixXmlPI方法的典型用法代码示例。如果您正苦于以下问题:C# Lexer.FixXmlPI方法的具体用法?C# Lexer.FixXmlPI怎么用?C# Lexer.FixXmlPI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TidyNet.Lexer
的用法示例。
在下文中一共展示了Lexer.FixXmlPI方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseInternal
//.........这里部分代码省略.........
/* replaces presentational markup by style rules */
if (_options.MakeClean || _options.DropFontTags)
{
cleaner.CleanTree(lexer, document);
}
if (!document.CheckNodeIntegrity())
{
Report.BadTree(lexer);
return null;
}
doctype = document.FindDocType();
if (document.Content != null)
{
if (_options.Xhtml)
{
lexer.SetXhtmlDocType(document);
}
else
{
lexer.FixDocType(document);
}
if (_options.TidyMark)
{
lexer.AddGenerator(document);
}
}
/* ensure presence of initial <?XML version="1.0"?> */
if (_options.XmlOut && _options.XmlPi)
{
lexer.FixXmlPI(document);
}
if (document.Content != null)
{
Report.ReportVersion(lexer, doctype);
Report.ReportNumWarnings(lexer);
}
}
// Try to close the InputStream but only if if we created it.
if ((file != null) && (input != Console.OpenStandardOutput()))
{
try
{
input.Close();
}
catch (IOException)
{
}
}
if (lexer.messages.Errors > 0)
{
Report.NeedsAuthorIntervention(lexer);
}
o.State = StreamIn.FSM_ASCII;
o.Encoding = _options.CharEncoding;
if (lexer.messages.Errors == 0)
{
示例2: parseXMLDocument
public static Node parseXMLDocument(Lexer lexer)
{
Node node, document, doctype;
document = lexer.NewNode();
document.Type = Node.RootNode;
doctype = null;
lexer.Options.XmlTags = true;
while (true)
{
node = lexer.GetToken(Lexer.IgnoreWhitespace);
if (node == null)
{
break;
}
/* discard unexpected end tags */
if (node.Type == Node.EndTag)
{
Report.Warning(lexer, null, node, Report.UNEXPECTED_ENDTAG);
continue;
}
/* deal with comments etc. */
if (Node.InsertMisc(document, node))
{
continue;
}
if (node.Type == Node.DocTypeTag)
{
if (doctype == null)
{
Node.InsertNodeAtEnd(document, node);
doctype = node;
}
else
{
Report.Warning(lexer, document, node, Report.DISCARDING_UNEXPECTED);
}
// TODO
continue;
}
/* if start tag then parse element's content */
if (node.Type == Node.StartTag)
{
Node.InsertNodeAtEnd(document, node);
parseXMLElement(lexer, node, Lexer.IgnoreWhitespace);
}
}
if (doctype != null && !lexer.CheckDocTypeKeyWords(doctype))
{
Report.Warning(lexer, doctype, null, Report.DTYPE_NOT_UPPER_CASE);
}
/* ensure presence of initial <?XML version="1.0"?> */
if (lexer.Options.XmlPi)
{
lexer.FixXmlPI(document);
}
return document;
}