本文整理汇总了C#中System.Xml.Schema.XmlSchemaSimpleType.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# XmlSchemaSimpleType.GetType方法的具体用法?C# XmlSchemaSimpleType.GetType怎么用?C# XmlSchemaSimpleType.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.Schema.XmlSchemaSimpleType
的用法示例。
在下文中一共展示了XmlSchemaSimpleType.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteSimpleTypeDoc
/// <summary>
/// Write a documentation file for a simple type.
/// </summary>
/// <param name="schema">Parent schema of the simple type.</param>
/// <param name="simpleType">The simple type.</param>
private void WriteSimpleTypeDoc(XmlSchema schema, XmlSchemaSimpleType simpleType)
{
string htmlFile = this.GetSchemaHtmlFile(schema, String.Concat("simple_type_", simpleType.Name));
XmlTextWriter writer = null;
try
{
writer = StartHtmlWriter(htmlFile, String.Format("{0} (Simple Type)", simpleType.Name), "simpleTypeHeader");
writer.WriteStartElement("dl");
// description
this.WriteDescription(simpleType, writer);
// details
if (simpleType.Content is XmlSchemaSimpleTypeRestriction)
{
XmlSchemaSimpleTypeRestriction simpleTypeRestriction = (XmlSchemaSimpleTypeRestriction)simpleType.Content;
if (simpleTypeRestriction.Facets.Count > 0)
{
XmlSchemaObject firstFacet = simpleTypeRestriction.Facets[0];
if (firstFacet is XmlSchemaEnumerationFacet)
{
writer.WriteStartElement("dt");
writer.WriteString("Enumeration Type");
writer.WriteEndElement();
writer.WriteStartElement("dd");
bool first = true;
writer.WriteString("Possible values: {");
foreach (XmlSchemaEnumerationFacet enumerationFacet in simpleTypeRestriction.Facets)
{
if (first)
{
first = false;
}
else
{
writer.WriteString(", ");
}
writer.WriteString(enumerationFacet.Value);
}
writer.WriteString("}");
writer.WriteEndElement();
}
else if (firstFacet is XmlSchemaPatternFacet)
{
XmlSchemaPatternFacet patternFacet = (XmlSchemaPatternFacet)firstFacet;
writer.WriteStartElement("dt");
writer.WriteString("Pattern Type");
writer.WriteEndElement();
writer.WriteStartElement("dd");
writer.WriteString(String.Format("Must match the regular expression: '{0}'.", patternFacet.Value));
writer.WriteEndElement();
}
else // some other base
{
writer.WriteStartElement("dt");
if (simpleTypeRestriction.BaseTypeName.Namespace == XmlSchemaNamespace)
{
writer.WriteString("xs:");
}
writer.WriteString(simpleTypeRestriction.BaseTypeName.Name);
writer.WriteString(" Type");
writer.WriteEndElement();
writer.WriteStartElement("dd");
writer.WriteStartElement("ul");
writer.WriteStartElement("li");
foreach (XmlSchemaFacet facet in simpleTypeRestriction.Facets)
{
if (facet is XmlSchemaMaxInclusiveFacet)
{
writer.WriteString(String.Format("xs:maxInclusive value='{0}'", ((XmlSchemaMaxInclusiveFacet)facet).Value));
}
else
{
throw new ApplicationException(String.Format("Unknown simple type restriction facet type: '{0}'.", facet.GetType().ToString()));
}
}
writer.WriteEndElement();
writer.WriteEndElement();
writer.WriteEndElement();
}
}
}
else
{
throw new ApplicationException(String.Format("Unknown simple type content type: '{0}'.", simpleType.GetType().ToString()));
}
//.........这里部分代码省略.........
示例2: Write34_XmlSchemaSimpleType
private void Write34_XmlSchemaSimpleType(string n, string ns, XmlSchemaSimpleType o, bool isNullable, bool needType)
{
if (o == null)
{
if (isNullable)
{
base.WriteNullTagLiteral(n, ns);
}
}
else
{
if (!needType && !(o.GetType() == typeof(XmlSchemaSimpleType)))
{
throw base.CreateUnknownTypeException(o);
}
base.EscapeName = false;
base.WriteStartElement(n, ns, o, false, o.Namespaces);
if (needType)
{
base.WriteXsiType("XmlSchemaSimpleType", "http://www.w3.org/2001/XMLSchema");
}
base.WriteAttribute("id", "", o.Id);
XmlAttribute[] unhandledAttributes = o.UnhandledAttributes;
if (unhandledAttributes != null)
{
for (int i = 0; i < unhandledAttributes.Length; i++)
{
XmlAttribute node = unhandledAttributes[i];
base.WriteXmlAttribute(node, o);
}
}
base.WriteAttribute("name", "", o.Name);
if (o.Final != XmlSchemaDerivationMethod.None)
{
base.WriteAttribute("final", "", this.Write7_XmlSchemaDerivationMethod(o.Final));
}
this.Write11_XmlSchemaAnnotation("annotation", "http://www.w3.org/2001/XMLSchema", o.Annotation, false, false);
if (o.Content is XmlSchemaSimpleTypeUnion)
{
this.Write33_XmlSchemaSimpleTypeUnion("union", "http://www.w3.org/2001/XMLSchema", (XmlSchemaSimpleTypeUnion) o.Content, false, false);
}
else if (o.Content is XmlSchemaSimpleTypeRestriction)
{
this.Write32_XmlSchemaSimpleTypeRestriction("restriction", "http://www.w3.org/2001/XMLSchema", (XmlSchemaSimpleTypeRestriction) o.Content, false, false);
}
else if (o.Content is XmlSchemaSimpleTypeList)
{
this.Write17_XmlSchemaSimpleTypeList("list", "http://www.w3.org/2001/XMLSchema", (XmlSchemaSimpleTypeList) o.Content, false, false);
}
else if (o.Content != null)
{
throw base.CreateUnknownTypeException(o.Content);
}
base.WriteEndElement(o);
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:56,代码来源:ServiceDescriptionSerializationWriter.cs