本文整理汇总了C#中ConformanceLevel类的典型用法代码示例。如果您正苦于以下问题:C# ConformanceLevel类的具体用法?C# ConformanceLevel怎么用?C# ConformanceLevel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConformanceLevel类属于命名空间,在下文中一共展示了ConformanceLevel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MwsXmlBuilder
public MwsXmlBuilder(bool toWrap, ConformanceLevel conformanceLevel)
{
builder = new StringBuilder();
XmlWriterSettings settings = new XmlWriterSettings();
settings.OmitXmlDeclaration = !toWrap;
settings.ConformanceLevel = conformanceLevel;
writer = XmlWriter.Create(builder, settings);
}
示例2: CheckReaderSettings
private static void CheckReaderSettings(XmlReaderSettings settings, ConformanceLevel expectedConformanceLevel)
{
Assert.IsFalse(settings.CheckCharacters);
#if NET_4_0 && !__MonoCS__
Assert.AreEqual(DtdProcessing.Parse, settings.DtdProcessing);
#else
Assert.IsTrue(settings.ProhibitDtd);
#endif
Assert.AreEqual(ValidationType.None , settings.ValidationType);
Assert.IsTrue(settings.CloseInput);
Assert.IsTrue(settings.IgnoreWhitespace);
Assert.AreEqual(expectedConformanceLevel, settings.ConformanceLevel);
}
示例3: Reset
public void Reset()
{
checkCharacters = true;
closeOutput = false;
conformance = ConformanceLevel.Document;
encoding = Encoding.UTF8;
indent = false;
indentChars = " ";
newLineChars = Environment.NewLine;
newLineOnAttributes = false;
newLineHandling = NewLineHandling.Replace;
normalizeNewLines = true;
omitXmlDeclaration = false;
outputMethod = XmlOutputMethod.AutoDetect;
}
示例4: Reset
public void Reset ()
{
checkCharacters = true;
closeOutput = false; // ? not documented
conformance = ConformanceLevel.Document;
encoding = Encoding.UTF8;
indent = false;
indentChars = " ";
// LAMESPEC: MS.NET says it is "\r\n", but it is silly decision.
newLineChars = Environment.NewLine;
newLineOnAttributes = false;
newLineHandling = NewLineHandling.None;
omitXmlDeclaration = false;
outputMethod = XmlOutputMethod.AutoDetect;
}
示例5: Reset
public void Reset ()
{
checkCharacters = true;
closeOutput = false; // ? not documented
conformance = ConformanceLevel.Document;
encoding = Encoding.UTF8;
indent = false;
indentChars = " ";
newLineChars = "\r\n";
newLineOnAttributes = false;
newLineHandling = NewLineHandling.Replace;
omitXmlDeclaration = false;
outputMethod = XmlOutputMethod.AutoDetect;
#if NET_4_5
isAsync = false;
#endif
}
示例6: CreateXmlWriterSettings
///<summary>
/// Return an XmlWriterSettings suitable for use in Chorus applications.
///</summary>
/// <remarks>
/// This formats with new line on attributes, indents with tab, and encoded in UTF8 with no BOM.
/// </remarks>
/// <param name="conformanceLevel">Document|Fragment</param>
///<returns>XmlWriterSettings</returns>
public static XmlWriterSettings CreateXmlWriterSettings(ConformanceLevel conformanceLevel)
{
var settings = new XmlWriterSettings
{
NewLineOnAttributes = true, // New line for each attribute, saves space on a typical Chorus changeset.
Indent = true, // Indent entities
IndentChars = "\t", // Tabs for the indent
CheckCharacters = false,
Encoding = new UTF8Encoding(false), // UTF8 without a BOM.
CloseOutput = true, // Close the underlying stream on Close. This is not the default.
ConformanceLevel = conformanceLevel,
NewLineChars = "\r\n", // Use /r/n for our end of lines
NewLineHandling = NewLineHandling.None, // Assume that the input is as written /r/n
OmitXmlDeclaration = false // The default, an xml declaration is written
};
return settings;
}
示例7: CreateXmlReaderSettings
///<summary>
/// Return an XmlReaderSettings suitable for use in Chorus applications.
///</summary>
/// <remarks>
/// This formats with:
/// CheckCharacters as 'false',
/// ProhibitDtd as 'true',
/// ValidationType as ValidationType.None,
/// CloseInput as 'true',
/// IgnoreWhitespace as 'true', and
/// ConformanceLevel as 'conformanceLevel' parameter.
/// </remarks>
/// <param name="conformanceLevel">Document|Fragment</param>
///<returns>XmlReaderSettings</returns>
public static XmlReaderSettings CreateXmlReaderSettings(ConformanceLevel conformanceLevel)
{
var settings = new XmlReaderSettings
{
CheckCharacters = false,
ConformanceLevel = conformanceLevel,
#if NET_4_0 && !__MonoCS__
DtdProcessing = DtdProcessing.Parse,
#else
ProhibitDtd = true,
#endif
ValidationType = ValidationType.None,
CloseInput = true,
IgnoreWhitespace = true
};
return settings;
}
示例8: Reset
public void Reset ()
{
checkCharacters = true;
closeInput = false; // ? not documented
conformance = ConformanceLevel.Document;
ignoreComments = false;
ignoreProcessingInstructions = false;
ignoreWhitespace = false;
lineNumberOffset = 0;
linePositionOffset = 0;
prohibitDtd = true;
#if MOONLIGHT
xmlResolver = new XmlXapResolver ();
#else
schemas = null;
schemasNeedsInitialization = true;
validationFlags =
XsValidationFlags.ProcessIdentityConstraints |
XsValidationFlags.AllowXmlAttributes;
validationType = ValidationType.None;
xmlResolver = new XmlUrlResolver ();
#endif
}
示例9: Initialize
void Initialize(XmlResolver resolver) {
nameTable = null;
#if !SILVERLIGHT
if (!EnableLegacyXmlSettings())
{
xmlResolver = resolver;
// limit the entity resolving to 10 million character. the caller can still
// override it to any other value or set it to zero for unlimiting it
maxCharactersFromEntities = (long) 1e7;
}
else
#endif
{
xmlResolver = (resolver == null ? CreateDefaultResolver() : resolver);
maxCharactersFromEntities = 0;
}
lineNumberOffset = 0;
linePositionOffset = 0;
checkCharacters = true;
conformanceLevel = ConformanceLevel.Document;
ignoreWhitespace = false;
ignorePIs = false;
ignoreComments = false;
dtdProcessing = DtdProcessing.Prohibit;
closeInput = false;
maxCharactersInDocument = 0;
#if !SILVERLIGHT
schemas = null;
validationType = ValidationType.None;
validationFlags = XmlSchemaValidationFlags.ProcessIdentityConstraints;
validationFlags |= XmlSchemaValidationFlags.AllowXmlAttributes;
#endif
#if ASYNC || FEATURE_NETCORE
useAsync = false;
#endif
isReadOnly = false;
#if !SILVERLIGHT
IsXmlResolverSet = false;
#endif
}
示例10: Initialize
//
// Private methods
//
private void Initialize()
{
_encoding = Encoding.UTF8;
_omitXmlDecl = false;
_newLineHandling = NewLineHandling.Replace;
_newLineChars = Environment.NewLine; // "\r\n" on Windows, "\n" on Unix
_indent = TriState.Unknown;
_indentChars = " ";
_newLineOnAttributes = false;
_closeOutput = false;
_namespaceHandling = NamespaceHandling.Default;
_conformanceLevel = ConformanceLevel.Document;
_checkCharacters = true;
_writeEndDocumentOnClose = true;
_outputMethod = XmlOutputMethod.Xml;
_cdataSections.Clear();
_mergeCDataSections = false;
_mediaType = null;
_docTypeSystem = null;
_docTypePublic = null;
_standalone = XmlStandalone.Omit;
_doNotEscapeUriAttributes = false;
_useAsync = false;
_isReadOnly = false;
}
示例11: OnRootElement
internal override void OnRootElement(ConformanceLevel currentConformanceLevel) {
// Just remember the current conformance level
conformanceLevel = currentConformanceLevel;
}
示例12: Reset
//
// Public methods
//
public void Reset() {
CheckReadOnly( "Reset" );
nameTable = null;
xmlResolver = new XmlUrlResolver();
lineNumberOffset = 0;
linePositionOffset = 0;
checkCharacters = true;
conformanceLevel = ConformanceLevel.Document;
schemas = null;
validationType = ValidationType.None;
validationFlags = XmlSchemaValidationFlags.ProcessIdentityConstraints;
validationFlags |= XmlSchemaValidationFlags.AllowXmlAttributes;
ignoreWhitespace = false;
ignorePIs = false;
ignoreComments = false;
prohibitDtd = true;
closeInput = false;
isReadOnly = false;
}
示例13: XmlParsingOptions
public XmlParsingOptions() {
this.ConformanceLevel = ConformanceLevel.Document;
this.XmlResolver = new XmlDynamicResolver(Assembly.GetCallingAssembly());
}
示例14: CreateWriter
public virtual XmlWriter CreateWriter(ConformanceLevel cl)
{
return this.XmlWriterTestModule.WriterFactory.CreateWriter(cl);
}
示例15: Initialize
private void Initialize(XmlResolver resolver)
{
_nameTable = null;
if (!EnableLegacyXmlSettings())
{
_xmlResolver = resolver;
// limit the entity resolving to 10 million character. the caller can still
// override it to any other value or set it to zero for unlimiting it
_maxCharactersFromEntities = (long)1e7;
}
else
{
_xmlResolver = (resolver == null ? CreateDefaultResolver() : resolver);
_maxCharactersFromEntities = 0;
}
_lineNumberOffset = 0;
_linePositionOffset = 0;
_checkCharacters = true;
_conformanceLevel = ConformanceLevel.Document;
_ignoreWhitespace = false;
_ignorePIs = false;
_ignoreComments = false;
_dtdProcessing = DtdProcessing.Prohibit;
_closeInput = false;
_maxCharactersInDocument = 0;
_schemas = null;
_validationType = ValidationType.None;
_validationFlags = XmlSchemaValidationFlags.ProcessIdentityConstraints;
_validationFlags |= XmlSchemaValidationFlags.AllowXmlAttributes;
_useAsync = false;
_isReadOnly = false;
IsXmlResolverSet = false;
}