本文整理汇总了C#中System.Xml.Schema.SchemaInfo类的典型用法代码示例。如果您正苦于以下问题:C# SchemaInfo类的具体用法?C# SchemaInfo怎么用?C# SchemaInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SchemaInfo类属于System.Xml.Schema命名空间,在下文中一共展示了SchemaInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Init
private void Init()
{
_nsManager = reader.NamespaceManager;
if (_nsManager == null)
{
_nsManager = new XmlNamespaceManager(NameTable);
_bManageNamespaces = true;
}
_validationStack = new HWStack(STACK_INCREMENT);
textValue = new StringBuilder();
_attPresence = new Hashtable();
schemaInfo = new SchemaInfo();
checkDatatype = false;
_processContents = XmlSchemaContentProcessing.Strict;
Push(XmlQualifiedName.Empty);
//Add common strings to be compared to NameTable
_nsXmlNs = NameTable.Add(XmlReservedNs.NsXmlNs);
_nsXs = NameTable.Add(XmlReservedNs.NsXs);
_nsXsi = NameTable.Add(XmlReservedNs.NsXsi);
_xsiType = NameTable.Add("type");
_xsiNil = NameTable.Add("nil");
_xsiSchemaLocation = NameTable.Add("schemaLocation");
_xsiNoNamespaceSchemaLocation = NameTable.Add("noNamespaceSchemaLocation");
_xsdSchema = NameTable.Add("schema");
}
开发者ID:geoffkizer,项目名称:corefx,代码行数:26,代码来源:XsdValidator.cs
示例2: StartParsingAsync
public async Task StartParsingAsync(XmlReader reader, string targetNamespace) {
this.reader = reader;
positionInfo = PositionInfo.GetPositionInfo(reader);
namespaceManager = reader.NamespaceManager;
if (namespaceManager == null) {
namespaceManager = new XmlNamespaceManager(nameTable);
isProcessNamespaces = true;
}
else {
isProcessNamespaces = false;
}
while (reader.NodeType != XmlNodeType.Element && await reader.ReadAsync().ConfigureAwait(false)) {}
markupDepth = int.MaxValue;
schemaXmlDepth = reader.Depth;
SchemaType rootType = schemaNames.SchemaTypeFromRoot(reader.LocalName, reader.NamespaceURI);
string code;
if (!CheckSchemaRoot(rootType, out code)) {
throw new XmlSchemaException(code, reader.BaseURI, positionInfo.LineNumber, positionInfo.LinePosition);
}
if (schemaType == SchemaType.XSD) {
schema = new XmlSchema();
schema.BaseUri = new Uri(reader.BaseURI, UriKind.RelativeOrAbsolute);
builder = new XsdBuilder(reader, namespaceManager, schema, nameTable, schemaNames, eventHandler);
}
else {
Debug.Assert(schemaType == SchemaType.XDR);
xdrSchema = new SchemaInfo();
xdrSchema.SchemaType = SchemaType.XDR;
builder = new XdrBuilder(reader, namespaceManager, xdrSchema, targetNamespace, nameTable, schemaNames, eventHandler);
((XdrBuilder)builder).XmlResolver = xmlResolver;
}
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:35,代码来源:ParserAsync.cs
示例3: StartParsing
internal void StartParsing(XmlReader reader, string targetNamespace, SchemaInfo schemaInfo) {
this.reader = reader;
positionInfo = PositionInfo.GetPositionInfo(reader);
this.namespaceManager = reader.NamespaceManager;
if (this.namespaceManager == null) {
this.namespaceManager = new XmlNamespaceManager(this.nameTable);
this.isProcessNamespaces = true;
}
else {
this.isProcessNamespaces = false;
}
while (this.reader.NodeType != XmlNodeType.Element && this.reader.Read()) {}
this.markupDepth = int.MaxValue;
this.schemaXmlDepth = reader.Depth;
XmlQualifiedName qname = new XmlQualifiedName(this.reader.LocalName, XmlSchemaDatatype.XdrCanonizeUri(this.reader.NamespaceURI, this.nameTable, this.schemaNames));
if (this.schemaNames.IsXDRRoot(qname)) {
Debug.Assert(schemaInfo != null);
schemaInfo.SchemaType = SchemaType.XDR;
this.schema = null;
this.builder = new XdrBuilder(reader, this.namespaceManager, schemaInfo, targetNamespace, this.nameTable, this.schemaNames, this.validationEventHandler);
}
else if (this.schemaNames.IsXSDRoot(qname)) {
if (schemaInfo != null) {
schemaInfo.SchemaType = SchemaType.XSD;
}
this.schema = new XmlSchema();
this.schema.BaseUri = reader.BaseURI;
this.builder = new XsdBuilder(reader, this.namespaceManager, this.schema, this.nameTable, this.schemaNames, this.validationEventHandler);
}
else {
throw new XmlSchemaException(Res.Sch_SchemaRootExpected, reader.BaseURI, positionInfo.LineNumber, positionInfo.LinePosition);
}
}
开发者ID:ArildF,项目名称:masters,代码行数:35,代码来源:parser.cs
示例4: Compile
internal void Compile(XmlSchema schema, string targetNamespace, SchemaInfo schemaInfo) {
//CompModSwitches.XmlSchema.Level = TraceLevel.Error;
schema.ErrorCount = 0;
Preprocess(schema, targetNamespace);
if (schema.ErrorCount == 0) {
CompileTo(schemaInfo);
}
}
开发者ID:ArildF,项目名称:masters,代码行数:8,代码来源:compiler.cs
示例5: Init
private void Init() {
Debug.Assert(reader != null);
validationStack = new HWStack(STACK_INCREMENT);
textValue = new StringBuilder();
name = XmlQualifiedName.Empty;
attPresence = new Hashtable();
schemaInfo = new SchemaInfo();
checkDatatype = false;
Push(name);
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:10,代码来源:DtdValidator.cs
示例6: Execute
public bool Execute(XmlSchemaSet schemaSet, SchemaInfo schemaCompiledInfo) {
Compile();
if (!HasErrors) {
Output(schemaCompiledInfo);
schemaSet.elements = elements;
schemaSet.attributes = attributes;
schemaSet.schemaTypes = schemaTypes;
schemaSet.substitutionGroups = examplars;
}
return !HasErrors;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:11,代码来源:SchemaSetCompiler.cs
示例7: Execute
public bool Execute(XmlSchema schema, SchemaInfo schemaInfo, bool compileContentModel) {
this.compileContentModel = compileContentModel;
this.schema = schema;
Prepare();
Cleanup();
Compile();
if (!HasErrors) {
Output(schemaInfo);
}
return !HasErrors;
}
开发者ID:uQr,项目名称:referencesource,代码行数:11,代码来源:SchemaCollectionCompiler.cs
示例8: CheckDefaultValue
public static void CheckDefaultValue(string value, SchemaAttDef attdef, SchemaInfo sinfo, XmlNamespaceManager nsManager, XmlNameTable NameTable, object sender, ValidationEventHandler eventhandler, string baseUri, int lineNo, int linePos)
{
try
{
XmlSchemaDatatype datatype = attdef.Datatype;
if (datatype != null)
{
if (datatype.TokenizedType != XmlTokenizedType.CDATA)
{
value = value.Trim();
}
if (value.Length != 0)
{
object pVal = datatype.ParseValue(value, NameTable, nsManager);
XmlTokenizedType tokenizedType = datatype.TokenizedType;
if (tokenizedType == XmlTokenizedType.ENTITY)
{
if (datatype.Variety == XmlSchemaDatatypeVariety.List)
{
string[] strArray = (string[]) pVal;
for (int i = 0; i < strArray.Length; i++)
{
BaseValidator.ProcessEntity(sinfo, strArray[i], sender, eventhandler, baseUri, lineNo, linePos);
}
}
else
{
BaseValidator.ProcessEntity(sinfo, (string) pVal, sender, eventhandler, baseUri, lineNo, linePos);
}
}
else if ((tokenizedType == XmlTokenizedType.ENUMERATION) && !attdef.CheckEnumeration(pVal))
{
XmlSchemaException ex = new XmlSchemaException("Sch_EnumerationValue", pVal.ToString(), baseUri, lineNo, linePos);
if (eventhandler == null)
{
throw ex;
}
eventhandler(sender, new ValidationEventArgs(ex));
}
attdef.DefaultValueTyped = pVal;
}
}
}
catch
{
XmlSchemaException exception2 = new XmlSchemaException("Sch_AttributeDefaultDataType", attdef.Name.ToString(), baseUri, lineNo, linePos);
if (eventhandler == null)
{
throw exception2;
}
eventhandler(sender, new ValidationEventArgs(exception2));
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:53,代码来源:XdrValidator.cs
示例9: Init
private void Init() {
nsManager = reader.NamespaceManager;
if (nsManager == null) {
nsManager = new XmlNamespaceManager(NameTable);
isProcessContents = true;
}
validationStack = new HWStack(STACK_INCREMENT);
textValue = new StringBuilder();
name = XmlQualifiedName.Empty;
attPresence = new Hashtable();
Push(XmlQualifiedName.Empty);
schemaInfo = new SchemaInfo();
checkDatatype = false;
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:14,代码来源:xdrvalidator.cs
示例10: Add
internal void Add(SchemaInfo sinfo, ValidationEventHandler eventhandler)
{
if (this.schemaType == System.Xml.Schema.SchemaType.None)
{
this.schemaType = sinfo.SchemaType;
}
else if (this.schemaType != sinfo.SchemaType)
{
if (eventhandler != null)
{
eventhandler(this, new ValidationEventArgs(new XmlSchemaException("Sch_MixSchemaTypes", string.Empty)));
}
return;
}
foreach (string str in sinfo.TargetNamespaces.Keys)
{
if (!this.targetNamespaces.ContainsKey(str))
{
this.targetNamespaces.Add(str, true);
}
}
foreach (KeyValuePair<XmlQualifiedName, SchemaElementDecl> pair in sinfo.elementDecls)
{
if (!this.elementDecls.ContainsKey(pair.Key))
{
this.elementDecls.Add(pair.Key, pair.Value);
}
}
foreach (KeyValuePair<XmlQualifiedName, SchemaElementDecl> pair2 in sinfo.elementDeclsByType)
{
if (!this.elementDeclsByType.ContainsKey(pair2.Key))
{
this.elementDeclsByType.Add(pair2.Key, pair2.Value);
}
}
foreach (SchemaAttDef def in sinfo.AttributeDecls.Values)
{
if (!this.attributeDecls.ContainsKey(def.Name))
{
this.attributeDecls.Add(def.Name, def);
}
}
foreach (SchemaNotation notation in sinfo.Notations.Values)
{
if (!this.Notations.ContainsKey(notation.Name.Name))
{
this.Notations.Add(notation.Name.Name, notation);
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:50,代码来源:SchemaInfo.cs
示例11: XdrBuilder
internal XdrBuilder(XmlReader reader, XmlNamespaceManager curmgr, SchemaInfo sinfo, string targetNamspace, XmlNameTable nameTable, SchemaNames schemaNames, ValidationEventHandler eventhandler)
{
this._SchemaInfo = sinfo;
this._TargetNamespace = targetNamspace;
this._reader = reader;
this._CurNsMgr = curmgr;
this.validationEventHandler = eventhandler;
this._StateHistory = new HWStack(10);
this._ElementDef = new ElementContent();
this._AttributeDef = new AttributeContent();
this._GroupStack = new HWStack(10);
this._GroupDef = new GroupContent();
this._NameTable = nameTable;
this._SchemaNames = schemaNames;
this._CurState = S_SchemaEntries[0];
this.positionInfo = PositionInfo.GetPositionInfo(this._reader);
this.xmlResolver = new XmlUrlResolver();
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:18,代码来源:XdrBuilder.cs
示例12: AddCompiledInfo
internal void AddCompiledInfo(SchemaInfo schemaInfo)
{
XmlQualifiedName qualifiedName;
foreach (XmlSchemaElement element in this.elements.Values)
{
qualifiedName = element.QualifiedName;
schemaInfo.TargetNamespaces[qualifiedName.Namespace] = true;
if (schemaInfo.ElementDecls[qualifiedName] == null)
{
schemaInfo.ElementDecls.Add(qualifiedName, element.ElementDecl);
}
}
foreach (XmlSchemaAttribute attribute in this.attributes.Values)
{
qualifiedName = attribute.QualifiedName;
schemaInfo.TargetNamespaces[qualifiedName.Namespace] = true;
if (schemaInfo.ElementDecls[qualifiedName] == null)
{
schemaInfo.AttributeDecls.Add(qualifiedName, attribute.AttDef);
}
}
foreach (XmlSchemaType type in this.types.Values)
{
qualifiedName = type.QualifiedName;
schemaInfo.TargetNamespaces[qualifiedName.Namespace] = true;
if ((!(type is XmlSchemaComplexType) || (type != XmlSchemaComplexType.AnyType)) && (schemaInfo.ElementDeclsByType[qualifiedName] == null))
{
schemaInfo.ElementDeclsByType.Add(qualifiedName, type.ElementDecl);
}
}
foreach (XmlSchemaNotation notation in this.notations.Values)
{
qualifiedName = notation.QualifiedName;
schemaInfo.TargetNamespaces[qualifiedName.Namespace] = true;
SchemaNotation notation2 = new SchemaNotation(qualifiedName) {
SystemLiteral = notation.System,
Pubid = notation.Public
};
if (schemaInfo.Notations[qualifiedName.Name] == null)
{
schemaInfo.Notations.Add(qualifiedName.Name, notation2);
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:44,代码来源:XmlSchema.cs
示例13: CheckDefaultValue
public static void CheckDefaultValue(SchemaAttDef attdef, SchemaInfo sinfo, IValidationEventHandling eventHandling, string baseUriStr)
{
try
{
if (baseUriStr == null)
{
baseUriStr = string.Empty;
}
XmlSchemaDatatype datatype = attdef.Datatype;
if (datatype != null)
{
object defaultValueTyped = attdef.DefaultValueTyped;
XmlTokenizedType tokenizedType = datatype.TokenizedType;
if (tokenizedType == XmlTokenizedType.ENTITY)
{
if (datatype.Variety == XmlSchemaDatatypeVariety.List)
{
string[] strArray = (string[]) defaultValueTyped;
for (int i = 0; i < strArray.Length; i++)
{
BaseValidator.ProcessEntity(sinfo, strArray[i], eventHandling, baseUriStr, attdef.ValueLineNumber, attdef.ValueLinePosition);
}
}
else
{
BaseValidator.ProcessEntity(sinfo, (string) defaultValueTyped, eventHandling, baseUriStr, attdef.ValueLineNumber, attdef.ValueLinePosition);
}
}
else if (((tokenizedType == XmlTokenizedType.ENUMERATION) && !attdef.CheckEnumeration(defaultValueTyped)) && (eventHandling != null))
{
XmlSchemaException exception = new XmlSchemaException("Sch_EnumerationValue", defaultValueTyped.ToString(), baseUriStr, attdef.ValueLineNumber, attdef.ValueLinePosition);
eventHandling.SendEvent(exception, XmlSeverityType.Error);
}
}
}
catch (Exception)
{
if (eventHandling != null)
{
XmlSchemaException exception2 = new XmlSchemaException("Sch_AttributeDefaultDataType", attdef.Name.ToString());
eventHandling.SendEvent(exception2, XmlSeverityType.Error);
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:44,代码来源:DtdValidator.cs
示例14: Validator
internal Validator(XmlNameTable nameTable, SchemaNames schemaNames, XmlValidatingReader reader) {
this.nameTable = nameTable;
this.schemaNames = schemaNames;
this.reader = reader;
positionInfo = PositionInfo.GetPositionInfo(reader);
nsManager = reader.NamespaceManager;
if (nsManager == null) {
nsManager = new XmlNamespaceManager(nameTable);
isProcessContents = true;
}
SchemaInfo = new SchemaInfo(schemaNames);
validationStack = new HWStack(STACK_INCREMENT);
textValue = new StringBuilder();
this.name = XmlQualifiedName.Empty;
attPresence = new Hashtable();
context = null;
attnDef = null;
}
开发者ID:ArildF,项目名称:masters,代码行数:19,代码来源:validator.cs
示例15: XmlSchemaSet
public XmlSchemaSet(XmlNameTable nameTable)
{
if (nameTable == null)
{
throw new ArgumentNullException("nameTable");
}
this.nameTable = nameTable;
this.schemas = new SortedList();
this.schemaLocations = new Hashtable();
this.chameleonSchemas = new Hashtable();
this.targetNamespaces = new Hashtable();
this.internalEventHandler = new System.Xml.Schema.ValidationEventHandler(this.InternalValidationCallback);
this.eventHandler = this.internalEventHandler;
this.readerSettings = new XmlReaderSettings();
this.readerSettings.NameTable = nameTable;
this.readerSettings.DtdProcessing = DtdProcessing.Prohibit;
this.compilationSettings = new XmlSchemaCompilationSettings();
this.cachedCompiledInfo = new SchemaInfo();
this.compileAll = true;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:20,代码来源:XmlSchemaSet.cs
示例16: Check
internal void Check(SchemaInfo sinfo, Validator validator, ValidationEventHandler eventhandler) {
Object o = null;
string code = null;
switch (RefType) {
case ForwardRef.Type.ID:
o = validator.FindID(ID);
code = Res.Sch_UndeclaredId;
break;
case ForwardRef.Type.NOTATION:
o = sinfo.Notations[ID];
code = Res.Sch_UndeclaredNotation;
break;
}
if (o == null) {
string baseuri = (null != validator && null != validator.BaseUri ? validator.BaseUri.AbsolutePath : string.Empty);
eventhandler(this, new ValidationEventArgs(new XmlSchemaException(code, ID, baseuri, Line, Col)));
}
}
开发者ID:ArildF,项目名称:masters,代码行数:20,代码来源:schemaforwardref.cs
示例17: Initialize
//
// Initialization methods
//
private void Initialize(IDtdParserAdapter readerAdapter)
{
Debug.Assert(readerAdapter != null);
_readerAdapter = readerAdapter;
#if !SILVERLIGHT
_readerAdapterWithValidation = readerAdapter as IDtdParserAdapterWithValidation;
#endif
_nameTable = readerAdapter.NameTable;
#if !SILVERLIGHT
IDtdParserAdapterWithValidation raWithValidation = readerAdapter as IDtdParserAdapterWithValidation;
if (raWithValidation != null)
{
_validate = raWithValidation.DtdValidation;
}
IDtdParserAdapterV1 raV1 = readerAdapter as IDtdParserAdapterV1;
if (raV1 != null)
{
_v1Compat = raV1.V1CompatibilityMode;
_normalize = raV1.Normalization;
_supportNamespaces = raV1.Namespaces;
}
#endif
_schemaInfo = new SchemaInfo();
#if !SILVERLIGHT
_schemaInfo.SchemaType = SchemaType.DTD;
#endif
_stringBuilder = new StringBuilder();
Uri baseUri = readerAdapter.BaseUri;
if (baseUri != null)
{
_documentBaseUri = baseUri.ToString();
}
_freeFloatingDtd = false;
}
开发者ID:chcosta,项目名称:corefx,代码行数:44,代码来源:DtdParser.cs
示例18: AutoValidator
public AutoValidator(XmlValidatingReaderImpl reader, XmlSchemaCollection schemaCollection, ValidationEventHandler eventHandler) : base(reader, schemaCollection, eventHandler) {
schemaInfo = new SchemaInfo();
}
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:3,代码来源:autovalidator.cs
示例19: StartParsing
public void StartParsing(XmlReader reader, string targetNamespace)
{
_reader = reader;
_positionInfo = PositionInfo.GetPositionInfo(reader);
_namespaceManager = reader.NamespaceManager;
if (_namespaceManager == null)
{
_namespaceManager = new XmlNamespaceManager(_nameTable);
_isProcessNamespaces = true;
}
else
{
_isProcessNamespaces = false;
}
while (reader.NodeType != XmlNodeType.Element && reader.Read()) { }
_markupDepth = int.MaxValue;
_schemaXmlDepth = reader.Depth;
SchemaType rootType = _schemaNames.SchemaTypeFromRoot(reader.LocalName, reader.NamespaceURI);
string code;
if (!CheckSchemaRoot(rootType, out code))
{
throw new XmlSchemaException(code, reader.BaseURI, _positionInfo.LineNumber, _positionInfo.LinePosition);
}
if (_schemaType == SchemaType.XSD)
{
_schema = new XmlSchema();
_schema.BaseUri = new Uri(reader.BaseURI, UriKind.RelativeOrAbsolute);
_builder = new XsdBuilder(reader, _namespaceManager, _schema, _nameTable, _schemaNames, _eventHandler);
}
else
{
Debug.Assert(_schemaType == SchemaType.XDR);
_xdrSchema = new SchemaInfo();
_xdrSchema.SchemaType = SchemaType.XDR;
_builder = new XdrBuilder(reader, _namespaceManager, _xdrSchema, targetNamespace, _nameTable, _schemaNames, _eventHandler);
((XdrBuilder)_builder).XmlResolver = _xmlResolver;
}
}
开发者ID:dotnet,项目名称:corefx,代码行数:41,代码来源:Parser.cs
示例20: LoadSchema
private bool LoadSchema(string uri)
{
if (_xmlResolver == null)
{
return false;
}
uri = _NameTable.Add(uri);
if (_SchemaInfo.TargetNamespaces.ContainsKey(uri))
{
return false;
}
SchemaInfo schemaInfo = null;
Uri _baseUri = _xmlResolver.ResolveUri(null, _reader.BaseURI);
XmlReader reader = null;
try
{
Uri ruri = _xmlResolver.ResolveUri(_baseUri, uri.Substring(x_schema.Length));
Stream stm = (Stream)_xmlResolver.GetEntity(ruri, null, null);
reader = new XmlTextReader(ruri.ToString(), stm, _NameTable);
schemaInfo = new SchemaInfo();
Parser parser = new Parser(SchemaType.XDR, _NameTable, _SchemaNames, _validationEventHandler);
parser.XmlResolver = _xmlResolver;
parser.Parse(reader, uri);
schemaInfo = parser.XdrSchema;
}
catch (XmlException e)
{
SendValidationEvent(SR.Sch_CannotLoadSchema, new string[] { uri, e.Message }, XmlSeverityType.Warning);
schemaInfo = null;
}
finally
{
if (reader != null)
{
reader.Close();
}
}
if (schemaInfo != null && schemaInfo.ErrorCount == 0)
{
_SchemaInfo.Add(schemaInfo, _validationEventHandler);
return true;
}
return false;
}
开发者ID:dotnet,项目名称:corefx,代码行数:44,代码来源:XdrBuilder.cs
注:本文中的System.Xml.Schema.SchemaInfo类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论