本文整理汇总了C#中System.Xml.Schema.XmlSchemaType类的典型用法代码示例。如果您正苦于以下问题:C# XmlSchemaType类的具体用法?C# XmlSchemaType怎么用?C# XmlSchemaType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlSchemaType类属于System.Xml.Schema命名空间,在下文中一共展示了XmlSchemaType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: IsSpecialXmlType
internal static bool IsSpecialXmlType(Type type, out XmlQualifiedName typeName, out XmlSchemaType xsdType, out bool hasRoot)
{
xsdType = null;
hasRoot = true;
if (type == Globals.TypeOfXmlElement || type == Globals.TypeOfXmlNodeArray)
{
string name = null;
if (type == Globals.TypeOfXmlElement)
{
xsdType = CreateAnyElementType();
name = "XmlElement";
hasRoot = false;
}
else
{
xsdType = CreateAnyType();
name = "ArrayOfXmlNode";
hasRoot = true;
}
typeName = new XmlQualifiedName(name, DataContract.GetDefaultStableNamespace(type));
return true;
}
typeName = null;
return false;
}
开发者ID:Profit0004,项目名称:mono,代码行数:25,代码来源:SchemaExporter_mobile.cs
示例2: ImportSchemaType
//public override string ImportSchemaType(
// string name,
// string ns,
// XmlSchemaObject context,
// XmlSchemas schemas,
// XmlSchemaImporter importer,
// CodeCompileUnit compileUnit,
// CodeNamespace mainNamespace,
// CodeGenerationOptions options,
// CodeDomProvider codeProvider)
//{
// XmlSchemaSimpleType simpleType = (XmlSchemaSimpleType) schemas.Find(new XmlQualifiedName(name, ns), typeof(XmlSchemaSimpleType));
// return ImportSchemaType(
// simpleType,
// context,
// schemas,
// importer,
// compileUnit,
// mainNamespace,
// options,
// codeProvider);
//}
public override string ImportSchemaType(
XmlSchemaType type,
XmlSchemaObject context,
XmlSchemas schemas,
XmlSchemaImporter importer,
CodeCompileUnit compileUnit,
CodeNamespace mainNamespace,
CodeGenerationOptions options,
CodeDomProvider codeProvider)
{
XmlSchemaAnnotated annotatedType = type as XmlSchemaAnnotated;
if (annotatedType == null)
return null;
if (annotatedType.Annotation == null)
return null;
// create the comments and add them to the hash table under the namespace of the object
CreateComments(annotatedType);
//mainNamespace.Types.
return null;
}
开发者ID:nujmail,项目名称:xsd-to-classes,代码行数:50,代码来源:AnnotationTypeExtension.cs
示例3: ImportSchemaType
public override string ImportSchemaType(XmlSchemaType type, XmlSchemaObject context, XmlSchemas schemas, XmlSchemaImporter importer, CodeCompileUnit compileUnit, CodeNamespace mainNamespace, CodeGenerationOptions options, CodeDomProvider codeProvider) {
if (type == null) {
return null;
}
if (importedTypes[type] != null) {
mainNamespace.Imports.Add(new CodeNamespaceImport(typeof(DataSet).Namespace));
compileUnit.ReferencedAssemblies.Add("System.Data.dll");
return (string)importedTypes[type];
}
if (!(context is XmlSchemaElement))
return null;
if (type is XmlSchemaComplexType) {
XmlSchemaComplexType ct = (XmlSchemaComplexType)type;
if (ct.Particle is XmlSchemaSequence) {
XmlSchemaObjectCollection items = ((XmlSchemaSequence)ct.Particle).Items;
if (items.Count == 2 && items[0] is XmlSchemaAny && items[1] is XmlSchemaAny) {
XmlSchemaAny any0 = (XmlSchemaAny)items[0];
XmlSchemaAny any1 = (XmlSchemaAny)items[1];
if (any0.Namespace == XmlSchema.Namespace && any1.Namespace == "urn:schemas-microsoft-com:xml-diffgram-v1") {
string typeName = typeof(DataTable).FullName;
importedTypes.Add(type, typeName);
mainNamespace.Imports.Add(new CodeNamespaceImport(typeof(DataTable).Namespace));
compileUnit.ReferencedAssemblies.Add("System.Data.dll");
return typeName;
}
}
}
}
return null;
}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:32,代码来源:DataTableSchemaImporterExtension.cs
示例4: TypeDesc
internal TypeDesc(string name, string fullName, XmlSchemaType dataType, TypeKind kind, TypeDesc baseTypeDesc, TypeFlags flags, string formatterName)
{
this.name = name.Replace('+', '.');
this.fullName = fullName.Replace('+', '.');
this.kind = kind;
this.baseTypeDesc = baseTypeDesc;
this.flags = flags;
this.isXsdType = kind == TypeKind.Primitive;
if (this.isXsdType)
{
this.weight = 1;
}
else if (kind == TypeKind.Enum)
{
this.weight = 2;
}
else if (this.kind == TypeKind.Root)
{
this.weight = -1;
}
else
{
this.weight = (baseTypeDesc == null) ? 0 : (baseTypeDesc.Weight + 1);
}
this.dataType = dataType;
this.formatterName = formatterName;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:TypeDesc.cs
示例5: XmlAtomicValue
//-----------------------------------------------
// XmlAtomicValue constructors and methods
//-----------------------------------------------
internal XmlAtomicValue(XmlSchemaType xmlType, bool value)
{
if (xmlType == null) throw new ArgumentNullException(nameof(xmlType));
_xmlType = xmlType;
_clrType = TypeCode.Boolean;
_unionVal.boolVal = value;
}
开发者ID:Corillian,项目名称:corefx,代码行数:11,代码来源:XmlAtomicValue.cs
示例6: SchemaObjectInfo
internal SchemaObjectInfo(XmlSchemaType type, XmlSchemaElement element, XmlSchema schema, List<XmlSchemaType> knownTypes)
{
this.type = type;
this.element = element;
this.schema = schema;
this.knownTypes = knownTypes;
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:7,代码来源:SchemaHelper.cs
示例7: Init
private void Init (bool value, XmlSchemaType xmlType)
{
if (xmlType == null)
throw new ArgumentNullException ("xmlType");
xmlTypeCode = XmlTypeCode.Boolean;
this.booleanValue = value;
schemaType = xmlType;
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:8,代码来源:XmlAtomicValue.cs
示例8: Init
private void Init (byte [] value, XmlSchemaType xmlType)
{
if (xmlType == null)
throw new ArgumentNullException ("xmlType");
xmlTypeCode = XmlTypeCode.Base64Binary;
this.bytesValue = value;
schemaType = xmlType;
}
开发者ID:nobled,项目名称:mono,代码行数:8,代码来源:XmlAtomicValue.cs
示例9: CreateClassDeclaration
internal static CodeTypeDeclaration CreateClassDeclaration(XmlSchemaType type)
{
string className = CodeIdentifier.MakeValid(type.QualifiedName.Name);
CodeTypeDeclaration codeClass = new CodeTypeDeclaration(className);
codeClass.TypeAttributes |= TypeAttributes.Public;
return codeClass;
}
开发者ID:nujmail,项目名称:xsd-to-classes,代码行数:8,代码来源:codeDomHelper.cs
示例10: GetXmlTypeInfo
internal static void GetXmlTypeInfo(Type type, out XmlQualifiedName stableName, out XmlSchemaType xsdType, out bool hasRoot)
{
if (IsSpecialXmlType(type, out stableName, out xsdType, out hasRoot))
return;
XmlSchemaSet schemas = null;
InvokeSchemaProviderMethod(type, schemas, out stableName, out xsdType, out hasRoot);
if (stableName.Name == null || stableName.Name.Length == 0)
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.Format(SR.InvalidXmlDataContractName, DataContract.GetClrTypeFullName(type))));
}
开发者ID:dotnet,项目名称:corefx,代码行数:9,代码来源:SchemaExporter.cs
示例11: XmlAtomicValue
internal XmlAtomicValue(XmlSchemaType xmlType, long value)
{
if (xmlType == null)
{
throw new ArgumentNullException("xmlType");
}
this.xmlType = xmlType;
this.clrType = TypeCode.Int64;
this.unionVal.i64Val = value;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:XmlAtomicValue.cs
示例12: GetXmlTypeInfo
internal static void GetXmlTypeInfo(Type type, out XmlQualifiedName stableName, out XmlSchemaType xsdType, out bool hasRoot)
{
if (IsSpecialXmlType(type, out stableName, out xsdType, out hasRoot))
return;
XmlSchemaSet schemas = new XmlSchemaSet();
schemas.XmlResolver = null;
InvokeSchemaProviderMethod(type, schemas, out stableName, out xsdType, out hasRoot);
if (stableName.Name == null || stableName.Name.Length == 0)
throw Fx.Exception.AsError(new InvalidDataContractException(SR.InvalidXmlDataContractName(DataContract.GetClrTypeFullName(type))));
}
开发者ID:nuxleus,项目名称:WCFWeb,代码行数:10,代码来源:SchemaExporter.cs
示例13: CreateProtoAnyType
XObject[] CreateProtoAnyType(XmlSchemaType schemaType) {
if ((schemaType as XmlSchemaComplexType) != null) {
return CreateProtoComplexType(schemaType as XmlSchemaComplexType);
} else if ((schemaType as XmlSchemaSimpleType) != null) {
var value = CreateProtoSimpleType(schemaType as XmlSchemaSimpleType);
return new XObject[] { new XText(value) };
} else {
throw new Exception("invalid schema type");
}
}
开发者ID:zzilla,项目名称:ONVIF-Device-Manager,代码行数:10,代码来源:XmlParser.cs
示例14: GetFacets
private static CompiledFacets GetFacets(XmlSchemaType type)
{
CompiledFacets compiledFacets = new CompiledFacets(type.Datatype);
XmlSchemaSimpleType simpleType = type as XmlSchemaSimpleType;
if(simpleType != null)
{
compiledFacets.compileFacets(simpleType);
}
return compiledFacets;
}
开发者ID:pusp,项目名称:o2platform,代码行数:11,代码来源:ClrSimpleTypeInfo.cs
示例15: InvokeSchemaProviderMethod
private static bool InvokeSchemaProviderMethod(Type clrType, XmlSchemaSet schemas, out XmlQualifiedName stableName, out XmlSchemaType xsdType, out bool hasRoot)
{
xsdType = null;
hasRoot = true;
object[] attrs = clrType.GetTypeInfo().GetCustomAttributes(Globals.TypeOfXmlSchemaProviderAttribute, false).ToArray();
if (attrs == null || attrs.Length == 0)
{
stableName = DataContract.GetDefaultStableName(clrType);
return false;
}
XmlSchemaProviderAttribute provider = (XmlSchemaProviderAttribute)attrs[0];
if (provider.IsAny)
{
xsdType = CreateAnyElementType();
hasRoot = false;
}
string methodName = provider.MethodName;
if (methodName == null || methodName.Length == 0)
{
if (!provider.IsAny)
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.Format(SR.InvalidGetSchemaMethod, DataContract.GetClrTypeFullName(clrType))));
stableName = DataContract.GetDefaultStableName(clrType);
}
else
{
MethodInfo getMethod = clrType.GetMethod(methodName, /*BindingFlags.DeclaredOnly |*/ BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public, new Type[] { typeof(XmlSchemaSet) });
if (getMethod == null)
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.Format(SR.MissingGetSchemaMethod, DataContract.GetClrTypeFullName(clrType), methodName)));
if (!(Globals.TypeOfXmlQualifiedName.IsAssignableFrom(getMethod.ReturnType)))
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.Format(SR.InvalidReturnTypeOnGetSchemaMethod, DataContract.GetClrTypeFullName(clrType), methodName, DataContract.GetClrTypeFullName(getMethod.ReturnType), DataContract.GetClrTypeFullName(Globals.TypeOfXmlQualifiedName))));
object typeInfo = getMethod.Invoke(null, new object[] { schemas });
if (provider.IsAny)
{
if (typeInfo != null)
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.Format(SR.InvalidNonNullReturnValueByIsAny, DataContract.GetClrTypeFullName(clrType), methodName)));
stableName = DataContract.GetDefaultStableName(clrType);
}
else if (typeInfo == null)
{
xsdType = CreateAnyElementType();
hasRoot = false;
stableName = DataContract.GetDefaultStableName(clrType);
}
else
{
stableName = (XmlQualifiedName)typeInfo;
}
}
return true;
}
开发者ID:dotnet,项目名称:corefx,代码行数:54,代码来源:SchemaExporter.cs
示例16: ImportSchemaType
public override string ImportSchemaType (XmlSchemaType type, XmlSchemaObject context, XmlSchemas schemas, XmlSchemaImporter importer, CodeCompileUnit compileUnit, CodeNamespace mainNamespace, CodeGenerationOptions options, CodeDomProvider codeProvider)
{
if (type == null)
return null;
var xe = context as XmlSchemaElement;
if (xe == null)
return null;
return null;
}
开发者ID:Profit0004,项目名称:mono,代码行数:11,代码来源:TypedDataSetSchemaImporterExtension.cs
示例17: AssertElement
public static void AssertElement (XmlSchemaElement element,
string name, XmlQualifiedName refName, string id,
XmlQualifiedName schemaTypeName, XmlSchemaType schemaType)
{
Assert.IsNotNull (element);
Assert.AreEqual (name, element.Name);
Assert.AreEqual (refName, element.RefName);
Assert.AreEqual (id, element.Id);
Assert.AreEqual (schemaTypeName, element.SchemaTypeName);
Assert.AreEqual (schemaType, element.SchemaType);
}
开发者ID:nobled,项目名称:mono,代码行数:11,代码来源:XmlSchemaAssertion.cs
示例18: AssertElement
protected void AssertElement (XmlSchemaElement element,
string name, XmlQualifiedName refName, string id,
XmlQualifiedName schemaTypeName, XmlSchemaType schemaType)
{
AssertNotNull (element);
AssertEquals (name, element.Name);
AssertEquals (refName, element.RefName);
AssertEquals (id, element.Id);
AssertEquals (schemaTypeName, element.SchemaTypeName);
AssertEquals (schemaType, element.SchemaType);
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:11,代码来源:XmlSchemaAssertion.cs
示例19: WriteImageWithTopicLink
private static void WriteImageWithTopicLink(this MamlWriter writer, TopicManager topicManager, ArtItem artItem, XmlSchemaType type)
{
var topic = topicManager.GetTopic(type);
if (topic != null)
{
writer.WriteHtmlArtItemWithTopicLink(artItem, topic);
}
else
{
writer.WriteHtmlArtItemWithText(artItem, type.QualifiedName.Name);
}
}
开发者ID:sergey-steinvil,项目名称:xsddoc,代码行数:12,代码来源:TypeNameMamlWriterExtensions.cs
示例20: ImportSchemaType
public virtual string ImportSchemaType (
XmlSchemaType type,
XmlSchemaObject context,
XmlSchemas schemas,
XmlSchemaImporter importer,
CodeCompileUnit compileUnit,
CodeNamespace mainNamespace,
CodeGenerationOptions options,
CodeDomProvider codeProvider
)
{
return null;
}
开发者ID:t-ashula,项目名称:mono,代码行数:13,代码来源:SchemaImporterExtension.cs
注:本文中的System.Xml.Schema.XmlSchemaType类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论