Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XsdValidator.cs
Go to the documentation of this file.
3using System.IO;
4using System.Text;
5
6namespace System.Xml.Schema;
7
8internal sealed class XsdValidator : BaseValidator
9{
10 private int _startIDConstraint = -1;
11
13
15
17
18 private bool _bManageNamespaces;
19
20 private Hashtable _IDs;
21
23
25
27
29
31
32 private static readonly XmlSchemaDatatype s_dtStringArray = s_dtCDATA.DeriveByList(null);
33
34 private string _nsXmlNs;
35
36 private string _nsXs;
37
38 private string _nsXsi;
39
40 private string _xsiType;
41
42 private string _xsiNil;
43
44 private string _xsiSchemaLocation;
45
47
48 private string _xsdSchema;
49
51
53
54 public override bool PreserveWhitespace
55 {
56 get
57 {
58 if (context.ElementDecl == null)
59 {
60 return false;
61 }
63 }
64 }
65
67
68 internal XsdValidator(BaseValidator validator)
69 : base(validator)
70 {
71 Init();
72 }
73
79
80 [MemberNotNull("_nsManager")]
81 [MemberNotNull("_validationStack")]
82 [MemberNotNull("_attPresence")]
83 [MemberNotNull("_processContents")]
84 [MemberNotNull("_nsXmlNs")]
85 [MemberNotNull("_nsXs")]
86 [MemberNotNull("_nsXsi")]
87 [MemberNotNull("_xsiType")]
88 [MemberNotNull("_xsiNil")]
89 [MemberNotNull("_xsiSchemaLocation")]
90 [MemberNotNull("_xsiNoNamespaceSchemaLocation")]
91 [MemberNotNull("_xsdSchema")]
92 private void Init()
93 {
95 if (_nsManager == null)
96 {
97 _nsManager = new XmlNamespaceManager(base.NameTable);
98 _bManageNamespaces = true;
99 }
100 _validationStack = new HWStack(10);
101 textValue = new StringBuilder();
102 _attPresence = new Hashtable();
103 schemaInfo = new SchemaInfo();
104 checkDatatype = false;
107 _nsXmlNs = base.NameTable.Add("http://www.w3.org/2000/xmlns/");
108 _nsXs = base.NameTable.Add("http://www.w3.org/2001/XMLSchema");
109 _nsXsi = base.NameTable.Add("http://www.w3.org/2001/XMLSchema-instance");
110 _xsiType = base.NameTable.Add("type");
111 _xsiNil = base.NameTable.Add("nil");
112 _xsiSchemaLocation = base.NameTable.Add("schemaLocation");
113 _xsiNoNamespaceSchemaLocation = base.NameTable.Add("noNamespaceSchemaLocation");
114 _xsdSchema = base.NameTable.Add("schema");
115 }
116
117 public override void Validate()
118 {
120 {
122 return;
123 }
124 switch (reader.NodeType)
125 {
126 case XmlNodeType.Element:
129 {
130 goto case XmlNodeType.EndElement;
131 }
132 break;
133 case XmlNodeType.Whitespace:
135 break;
136 case XmlNodeType.Text:
137 case XmlNodeType.CDATA:
138 case XmlNodeType.SignificantWhitespace:
139 ValidateText();
140 break;
141 case XmlNodeType.EndElement:
143 break;
144 }
145 }
146
147 public override void CompleteValidation()
148 {
150 }
151
152 private void ProcessInlineSchema()
153 {
155 {
156 return;
157 }
160 string text = null;
161 if (xmlSchema != null && xmlSchema.ErrorCount == 0)
162 {
163 try
164 {
167 text = ((xmlSchema.TargetNamespace == null) ? string.Empty : xmlSchema.TargetNamespace);
168 if (!base.SchemaInfo.TargetNamespaces.ContainsKey(text) && base.SchemaCollection.Add(text, schemaInfo, xmlSchema, compile: true) != null)
169 {
170 base.SchemaInfo.Add(schemaInfo, base.EventHandler);
171 }
172 }
173 catch (XmlSchemaException ex)
174 {
176 {
177 base.BaseUri.AbsoluteUri,
178 ex.Message
179 }, XmlSeverityType.Error);
180 }
181 }
182 _inlineSchemaParser = null;
183 }
184
185 private void ValidateElement()
186 {
188 object particle = ValidateChildElement();
190 {
191 _inlineSchemaParser = new Parser(SchemaType.XSD, base.NameTable, base.SchemaNames, base.EventHandler);
194 }
195 else
196 {
197 ProcessElement(particle);
198 }
199 }
200
201 private object ValidateChildElement()
202 {
203 object obj = null;
204 int errorCode = 0;
206 {
207 if (context.IsNill)
208 {
210 return null;
211 }
213 if (obj == null)
214 {
216 if (errorCode == -2)
217 {
219 }
220 XmlSchemaValidator.ElementValidationError(elementName, context, base.EventHandler, reader, reader.BaseURI, base.PositionInfo.LineNumber, base.PositionInfo.LinePosition, null);
221 }
222 }
223 return obj;
224 }
225
263
265 {
266 string[] array = null;
267 string text = null;
269 xsiNil = null;
270 if (reader.Depth == 0)
271 {
272 LoadSchema(string.Empty, null);
273 foreach (string value in _nsManager.GetNamespacesInScope(XmlNamespaceScope.ExcludeXml).Values)
274 {
275 LoadSchema(value, null);
276 }
277 }
279 {
280 do
281 {
283 string localName = reader.LocalName;
285 {
286 LoadSchema(reader.Value, null);
288 {
289 _nsManager.AddNamespace((reader.Prefix.Length == 0) ? string.Empty : reader.LocalName, reader.Value);
290 }
291 }
292 else if (Ref.Equal(namespaceURI, _nsXsi))
293 {
294 if (Ref.Equal(localName, _xsiSchemaLocation))
295 {
296 array = (string[])s_dtStringArray.ParseValue(reader.Value, base.NameTable, _nsManager);
297 }
298 else if (Ref.Equal(localName, _xsiNoNamespaceSchemaLocation))
299 {
300 text = reader.Value;
301 }
302 else if (Ref.Equal(localName, _xsiType))
303 {
304 xsiType = (XmlQualifiedName)s_dtQName.ParseValue(reader.Value, base.NameTable, _nsManager);
305 }
306 else if (Ref.Equal(localName, _xsiNil))
307 {
309 }
310 }
311 }
312 while (reader.MoveToNextAttribute());
314 }
315 if (text != null)
316 {
317 LoadSchema(string.Empty, text);
318 }
319 if (array != null)
320 {
321 for (int i = 0; i < array.Length - 1; i += 2)
322 {
323 LoadSchema(array[i], array[i + 1]);
324 }
325 }
326 }
327
328 private void ValidateEndElement()
329 {
331 {
333 }
334 if (context.ElementDecl != null)
335 {
336 if (!context.IsNill)
337 {
339 {
340 XmlSchemaValidator.CompleteValidationError(context, base.EventHandler, reader, reader.BaseURI, base.PositionInfo.LineNumber, base.PositionInfo.LinePosition, null);
341 }
343 {
344 string text = ((!hasSibling) ? textString : textValue.ToString());
345 if (text.Length != 0 || context.ElementDecl.DefaultValueTyped == null)
346 {
347 CheckValue(text, null);
348 checkDatatype = false;
349 }
350 }
351 }
353 {
355 }
356 }
357 Pop();
358 }
359
360 private SchemaElementDecl FastGetElementDecl(object particle)
361 {
362 SchemaElementDecl result = null;
363 if (particle != null)
364 {
366 {
367 result = xmlSchemaElement.ElementDecl;
368 }
369 else
370 {
372 _processContents = xmlSchemaAny.ProcessContentsCorrect;
373 }
374 }
375 return result;
376 }
377
379 {
380 if (elementDecl == null)
381 {
383 }
384 if (elementDecl != null)
385 {
386 if (xsiType.IsEmpty)
387 {
388 if (elementDecl.IsAbstract)
389 {
391 elementDecl = null;
392 }
393 }
394 else if (xsiNil != null && xsiNil.Equals("true"))
395 {
397 }
398 else
399 {
400 if (!schemaInfo.ElementDeclsByType.TryGetValue(xsiType, out var value) && xsiType.Namespace == _nsXs)
401 {
403 if (simpleTypeFromXsdType != null)
404 {
405 value = simpleTypeFromXsdType.ElementDecl;
406 }
407 }
408 if (value == null)
409 {
411 elementDecl = null;
412 }
413 else if (!XmlSchemaType.IsDerivedFrom(value.SchemaType, elementDecl.SchemaType, elementDecl.Block))
414 {
416 {
417 xsiType.ToString(),
418 XmlSchemaValidator.QNameString(context.LocalName, context.Namespace)
419 });
420 elementDecl = null;
421 }
422 else
423 {
425 }
426 }
427 if (elementDecl != null && elementDecl.IsNillable)
428 {
429 if (xsiNil != null)
430 {
432 if (context.IsNill && elementDecl.DefaultValueTyped != null)
433 {
435 }
436 }
437 }
438 else if (xsiNil != null)
439 {
441 }
442 }
443 return elementDecl;
444 }
445
446 private void ValidateStartElement()
447 {
448 if (context.ElementDecl != null)
449 {
451 {
453 }
456 {
458 context.IsNill = true;
459 }
460 else
461 {
463 }
465 {
467 }
468 }
470 {
471 return;
472 }
473 do
474 {
475 if ((object)reader.NamespaceURI == _nsXmlNs || (object)reader.NamespaceURI == _nsXsi)
476 {
477 continue;
478 }
479 try
480 {
485 if (attributeXsd != null)
486 {
488 {
490 }
492 if (attributeXsd.Datatype != null)
493 {
495 }
497 {
499 }
500 }
501 else if (!skip)
502 {
503 if (context.ElementDecl == null && _processContents == XmlSchemaContentProcessing.Strict && xmlQualifiedName.Namespace.Length != 0 && schemaInfo.Contains(xmlQualifiedName.Namespace))
504 {
506 }
507 else
508 {
510 }
511 }
512 }
513 catch (XmlSchemaException ex)
514 {
515 ex.SetSource(reader.BaseURI, base.PositionInfo.LineNumber, base.PositionInfo.LinePosition);
517 }
518 }
519 while (reader.MoveToNextAttribute());
521 }
522
524 {
526 {
527 for (int i = 0; i < context.ElementDecl.DefaultAttDefs.Count; i++)
528 {
532 {
533 AttributeIdentityConstraints(schemaAttDef.Name.Name, schemaAttDef.Name.Namespace, UnWrapUnion(schemaAttDef.DefaultValueTyped), schemaAttDef.DefaultValueRaw, schemaAttDef);
534 }
535 }
536 }
538 {
539 try
540 {
542 }
543 catch (XmlSchemaException ex)
544 {
545 ex.SetSource(reader.BaseURI, base.PositionInfo.LineNumber, base.PositionInfo.LinePosition);
547 }
548 }
549 if (context.ElementDecl.Datatype != null)
550 {
551 checkDatatype = true;
552 hasSibling = false;
553 textString = string.Empty;
555 }
556 }
557
558 private void LoadSchemaFromLocation(string uri, string url)
559 {
560 XmlReader xmlReader = null;
561 SchemaInfo schemaInfo = null;
562 try
563 {
564 Uri uri2 = base.XmlResolver.ResolveUri(base.BaseUri, url);
565 Stream input = (Stream)base.XmlResolver.GetEntity(uri2, null, null);
566 xmlReader = new XmlTextReader(uri2.ToString(), input, base.NameTable);
567 Parser parser = new Parser(SchemaType.XSD, base.NameTable, base.SchemaNames, base.EventHandler);
568 parser.XmlResolver = base.XmlResolver;
569 SchemaType schemaType = parser.Parse(xmlReader, uri);
570 schemaInfo = new SchemaInfo();
571 schemaInfo.SchemaType = schemaType;
572 if (schemaType == SchemaType.XSD)
573 {
574 if (base.SchemaCollection.EventHandler == null)
575 {
577 }
578 base.SchemaCollection.Add(uri, schemaInfo, parser.XmlSchema, compile: true);
579 }
580 base.SchemaInfo.Add(schemaInfo, base.EventHandler);
581 while (xmlReader.Read())
582 {
583 }
584 }
585 catch (XmlSchemaException ex)
586 {
587 schemaInfo = null;
588 SendValidationEvent(System.SR.Sch_CannotLoadSchema, new string[2] { uri, ex.Message }, XmlSeverityType.Error);
589 }
590 catch (Exception ex2)
591 {
592 schemaInfo = null;
593 SendValidationEvent(System.SR.Sch_CannotLoadSchema, new string[2] { uri, ex2.Message }, XmlSeverityType.Warning);
594 }
595 finally
596 {
597 xmlReader?.Close();
598 }
599 }
600
601 private void LoadSchema(string uri, string url)
602 {
603 if (base.XmlResolver == null || (base.SchemaInfo.TargetNamespaces.ContainsKey(uri) && _nsManager.LookupPrefix(uri) != null))
604 {
605 return;
606 }
607 SchemaInfo schemaInfo = null;
608 if (base.SchemaCollection != null)
609 {
610 schemaInfo = base.SchemaCollection.GetSchemaInfo(uri);
611 }
612 if (schemaInfo != null)
613 {
615 {
616 throw new XmlException(System.SR.Xml_MultipleValidaitonTypes, string.Empty, base.PositionInfo.LineNumber, base.PositionInfo.LinePosition);
617 }
618 base.SchemaInfo.Add(schemaInfo, base.EventHandler);
619 }
620 else if (url != null)
621 {
623 }
624 }
625
626 private void ProcessTokenizedType(XmlTokenizedType ttype, string name)
627 {
628 switch (ttype)
629 {
630 case XmlTokenizedType.ID:
631 if (FindId(name) != null)
632 {
634 }
635 else
636 {
637 AddID(name, context.LocalName);
638 }
639 break;
640 case XmlTokenizedType.IDREF:
641 {
642 object obj = FindId(name);
643 if (obj == null)
644 {
645 _idRefListHead = new IdRefNode(_idRefListHead, name, base.PositionInfo.LineNumber, base.PositionInfo.LinePosition);
646 }
647 break;
648 }
649 case XmlTokenizedType.ENTITY:
650 BaseValidator.ProcessEntity(schemaInfo, name, this, base.EventHandler, reader.BaseURI, base.PositionInfo.LineNumber, base.PositionInfo.LinePosition);
651 break;
652 case XmlTokenizedType.IDREFS:
653 break;
654 }
655 }
656
657 private void CheckValue(string value, SchemaAttDef attdef)
658 {
659 try
660 {
662 bool flag = attdef != null;
664 if (xmlSchemaDatatype == null)
665 {
666 return;
667 }
671 {
673 {
674 string[] array = (string[])obj;
675 for (int i = 0; i < array.Length; i++)
676 {
678 }
679 }
680 else
681 {
682 ProcessTokenizedType(xmlSchemaDatatype.TokenizedType, (string)obj);
683 }
684 }
686 if (!schemaDeclBase.CheckValue(obj))
687 {
688 if (flag)
689 {
691 }
692 else
693 {
695 }
696 }
697 if (xmlSchemaDatatype.Variety == XmlSchemaDatatypeVariety.Union)
698 {
700 }
702 }
703 catch (XmlSchemaException)
704 {
705 if (attdef != null)
706 {
708 }
709 else
710 {
712 }
713 }
714 }
715
716 internal void AddID(string name, object node)
717 {
718 if (_IDs == null)
719 {
720 _IDs = new Hashtable();
721 }
722 _IDs.Add(name, node);
723 }
724
725 public override object FindId(string name)
726 {
727 if (_IDs != null)
728 {
729 return _IDs[name];
730 }
731 return null;
732 }
733
734 public bool IsXSDRoot(string localName, string ns)
735 {
736 if (Ref.Equal(ns, _nsXs))
737 {
738 return Ref.Equal(localName, _xsdSchema);
739 }
740 return false;
741 }
742
759
760 private void Pop()
761 {
762 if (_validationStack.Length > 1)
763 {
766 {
768 }
771 }
772 }
773
774 private void CheckForwardRefs()
775 {
777 while (idRefNode != null)
778 {
779 if (FindId(idRefNode.Id) == null)
780 {
782 }
783 IdRefNode next = idRefNode.Next;
784 idRefNode.Next = null;
785 idRefNode = next;
786 }
787 _idRefListHead = null;
788 }
789
791 {
792 if (context.ElementDecl != null)
793 {
794 if (context.ElementDecl.Constraints != null)
795 {
797 }
799 {
801 }
802 }
803 }
804
806 {
808 int num = 0;
809 for (int i = 0; i < context.ElementDecl.Constraints.Length; i++)
810 {
812 }
813 for (int j = 0; j < context.Constr.Length; j++)
814 {
816 {
817 continue;
818 }
819 bool flag = false;
821 {
822 if (((ValidationState)_validationStack[num2]).Constr != null)
823 {
825 for (int k = 0; k < constr.Length; k++)
826 {
827 if (constr[k].constraint.name == context.Constr[j].constraint.refer)
828 {
829 flag = true;
830 if (constr[k].keyrefTable == null)
831 {
832 constr[k].keyrefTable = new Hashtable();
833 }
834 context.Constr[j].qualifiedTable = constr[k].keyrefTable;
835 break;
836 }
837 }
838 if (flag)
839 {
840 break;
841 }
842 }
843 }
844 if (!flag)
845 {
847 }
848 }
849 if (_startIDConstraint == -1)
850 {
852 }
853 }
854
856 {
857 for (int i = _startIDConstraint; i < _validationStack.Length; i++)
858 {
859 if (((ValidationState)_validationStack[i]).Constr == null)
860 {
861 continue;
862 }
864 for (int j = 0; j < constr.Length; j++)
865 {
866 if (constr[j].axisSelector.MoveToStartElement(reader.LocalName, reader.NamespaceURI))
867 {
868 constr[j].axisSelector.PushKS(base.PositionInfo.LineNumber, base.PositionInfo.LinePosition);
869 }
870 for (int k = 0; k < constr[j].axisFields.Count; k++)
871 {
873 if (locatedActiveAxis.MoveToStartElement(reader.LocalName, reader.NamespaceURI) && context.ElementDecl != null)
874 {
875 if (context.ElementDecl.Datatype == null)
876 {
878 }
879 else
880 {
882 }
883 }
884 }
885 }
886 }
887 }
888
889 private void AttributeIdentityConstraints(string name, string ns, object obj, string sobj, SchemaAttDef attdef)
890 {
891 for (int i = _startIDConstraint; i < _validationStack.Length; i++)
892 {
893 if (((ValidationState)_validationStack[i]).Constr == null)
894 {
895 continue;
896 }
898 for (int j = 0; j < constr.Length; j++)
899 {
900 for (int k = 0; k < constr[j].axisFields.Count; k++)
901 {
903 if (locatedActiveAxis.MoveToAttribute(name, ns))
904 {
905 if (locatedActiveAxis.Ks[locatedActiveAxis.Column] != null)
906 {
908 }
909 else if (attdef != null && attdef.Datatype != null)
910 {
911 locatedActiveAxis.Ks[locatedActiveAxis.Column] = new TypedObject(obj, sobj, attdef.Datatype);
912 }
913 }
914 }
915 }
916 }
917 }
918
919 private object UnWrapUnion(object typedValue)
920 {
921 if (typedValue is XsdSimpleValue xsdSimpleValue)
922 {
923 typedValue = xsdSimpleValue.TypedValue;
924 }
925 return typedValue;
926 }
927
929 {
930 for (int num = _validationStack.Length - 1; num >= _startIDConstraint; num--)
931 {
932 if (((ValidationState)_validationStack[num]).Constr != null)
933 {
935 for (int i = 0; i < constr.Length; i++)
936 {
937 for (int j = 0; j < constr[i].axisFields.Count; j++)
938 {
940 if (locatedActiveAxis.isMatched)
941 {
943 if (locatedActiveAxis.Ks[locatedActiveAxis.Column] != null)
944 {
946 }
947 else
948 {
949 string text = ((!hasSibling) ? textString : textValue.ToString());
950 if (reader.TypedValueObject != null && text.Length != 0)
951 {
953 }
954 }
955 }
957 }
958 if (!constr[i].axisSelector.EndElement(reader.LocalName, reader.NamespaceURI))
959 {
960 continue;
961 }
962 KeySequence keySequence = constr[i].axisSelector.PopKS();
963 switch (constr[i].constraint.Role)
964 {
966 if (!keySequence.IsQualified())
967 {
968 SendValidationEvent(new XmlSchemaException(System.SR.Sch_MissingKey, constr[i].constraint.name.ToString(), reader.BaseURI, keySequence.PosLine, keySequence.PosCol));
969 }
970 else if (constr[i].qualifiedTable.Contains(keySequence))
971 {
973 {
974 keySequence.ToString(),
975 constr[i].constraint.name.ToString()
976 }, reader.BaseURI, keySequence.PosLine, keySequence.PosCol));
977 }
978 else
979 {
980 constr[i].qualifiedTable.Add(keySequence, keySequence);
981 }
982 break;
984 if (keySequence.IsQualified())
985 {
986 if (constr[i].qualifiedTable.Contains(keySequence))
987 {
989 {
990 keySequence.ToString(),
991 constr[i].constraint.name.ToString()
992 }, reader.BaseURI, keySequence.PosLine, keySequence.PosCol));
993 }
994 else
995 {
996 constr[i].qualifiedTable.Add(keySequence, keySequence);
997 }
998 }
999 break;
1001 if (constr[i].qualifiedTable != null && keySequence.IsQualified() && !constr[i].qualifiedTable.Contains(keySequence))
1002 {
1003 constr[i].qualifiedTable.Add(keySequence, keySequence);
1004 }
1005 break;
1006 }
1007 }
1008 }
1009 }
1011 if (constr2 == null)
1012 {
1013 return;
1014 }
1015 for (int k = 0; k < constr2.Length; k++)
1016 {
1017 if (constr2[k].constraint.Role == CompiledIdentityConstraint.ConstraintRole.Keyref || constr2[k].keyrefTable == null)
1018 {
1019 continue;
1020 }
1021 foreach (KeySequence key in constr2[k].keyrefTable.Keys)
1022 {
1023 if (!constr2[k].qualifiedTable.Contains(key))
1024 {
1026 {
1027 key.ToString(),
1028 constr2[k].constraint.name.ToString()
1029 }, reader.BaseURI, key.PosLine, key.PosCol));
1030 }
1031 }
1032 }
1033 }
1034}
virtual bool Contains(object key)
Definition Hashtable.cs:719
virtual void Add(object key, object? value)
Definition Hashtable.cs:676
static string Xml_MultipleValidaitonTypes
Definition SR.cs:220
static string Sch_AttributeValueDataType
Definition SR.cs:1808
static string Sch_ElementValueDataType
Definition SR.cs:1810
static string Sch_ContentInNill
Definition SR.cs:784
static string Sch_FixedElementValue
Definition SR.cs:494
static string Sch_UndeclaredId
Definition SR.cs:418
static string Sch_XsiTypeNotFound
Definition SR.cs:602
static string Sch_InvalidXsiNill
Definition SR.cs:874
static string Sch_NoAttributeSchemaFound
Definition SR.cs:788
static string Sch_UnresolvedKeyref
Definition SR.cs:732
static string Sch_FieldSimpleTypeExpected
Definition SR.cs:738
static string Sch_AbstractElement
Definition SR.cs:870
static string Sch_RefNotInScope
Definition SR.cs:718
static string Sch_FixedAttributeValue
Definition SR.cs:492
static string Sch_NoElementSchemaFound
Definition SR.cs:786
static string Sch_XsiNilAndType
Definition SR.cs:1132
static string Sch_XsiTypeBlockedEx
Definition SR.cs:872
static string Sch_XsiNilAndFixed
Definition SR.cs:1120
static string Sch_UndeclaredElement
Definition SR.cs:412
static string Sch_MissingKey
Definition SR.cs:742
static string Sch_CannotLoadSchema
Definition SR.cs:1078
static string Sch_DuplicateKey
Definition SR.cs:744
static string Sch_FieldSingleValueExpected
Definition SR.cs:740
static string Sch_DupId
Definition SR.cs:410
static string Sch_AllElement
Definition SR.cs:594
static string Sch_UndeclaredAttribute
Definition SR.cs:414
Definition SR.cs:7
override string ToString()
void AddToTop(object o)
Definition HWStack.cs:90
object Push()
Definition HWStack.cs:52
object Peek()
Definition HWStack.cs:81
static bool Equal(string strA, string strB)
Definition Ref.cs:5
void SendValidationEvent(string code)
XmlValidatingReaderImpl reader
static void ProcessEntity(SchemaInfo sinfo, string name, object sender, ValidationEventHandler eventhandler, string baseUri, int lineNumber, int linePosition)
CompiledIdentityConstraint constraint
virtual void InitValidation(ValidationState context)
virtual bool CompleteValidation(ValidationState context)
virtual object ValidateElement(XmlQualifiedName name, ValidationState context, out int errorCode)
static XmlSchemaSimpleType GetSimpleTypeFromXsdType(XmlQualifiedName qname)
SchemaType FinishParsing()
Definition Parser.cs:157
void StartParsing(XmlReader reader, string targetNamespace)
Definition Parser.cs:78
void CheckAttributes(Hashtable presence, bool standalone)
IList< IDtdDefaultAttributeInfo > DefaultAttDefs
CompiledIdentityConstraint[] Constraints
Dictionary< XmlQualifiedName, SchemaElementDecl > ElementDeclsByType
Definition SchemaInfo.cs:97
SchemaElementDecl GetElementDecl(XmlQualifiedName qname)
SchemaAttDef GetAttributeXsd(SchemaElementDecl ed, XmlQualifiedName qname, XmlSchemaObject partialValidationType, out AttributeMatchState attributeMatchState)
int PushKS(int errline, int errcol)
XmlSchemaContentProcessing ProcessContents
object ParseValue(string s, XmlNameTable? nameTable, IXmlNamespaceResolver? nsmgr)
static XmlSchemaDatatype FromXmlTokenizedType(XmlTokenizedType token)
static XmlSchemaDatatype FromXmlTokenizedTypeXsd(XmlTokenizedType token)
static bool IsDerivedFrom([NotNullWhen(true)] XmlSchemaType? derivedType, [NotNullWhen(true)] XmlSchemaType? baseType, XmlSchemaDerivationMethod except)
static void ElementValidationError(XmlQualifiedName name, ValidationState context, ValidationEventHandler eventHandler, object sender, string sourceUri, int lineNo, int linePos, XmlSchemaSet schemaSet)
static void CompleteValidationError(ValidationState context, ValidationEventHandler eventHandler, object sender, string sourceUri, int lineNo, int linePos, XmlSchemaSet schemaSet)
static string QNameString(string localName, string ns)
object UnWrapUnion(object typedValue)
void ProcessXsiAttributes(out XmlQualifiedName xsiType, out string xsiNil)
void AttributeIdentityConstraints(string name, string ns, object obj, string sobj, SchemaAttDef attdef)
SchemaElementDecl ThoroughGetElementDecl(SchemaElementDecl elementDecl, XmlQualifiedName xsiType, string xsiNil)
static readonly XmlSchemaDatatype s_dtStringArray
void Push(XmlQualifiedName elementName)
void AddID(string name, object node)
static readonly XmlSchemaDatatype s_dtCDATA
bool IsXSDRoot(string localName, string ns)
void ProcessElement(object particle)
XmlSchemaContentProcessing _processContents
override object FindId(string name)
static readonly XmlSchemaDatatype s_dtQName
void CheckValue(string value, SchemaAttDef attdef)
void ProcessTokenizedType(XmlTokenizedType ttype, string name)
XmlNamespaceManager _nsManager
XsdValidator(XmlValidatingReaderImpl reader, XmlSchemaCollection schemaCollection, IValidationEventHandling eventHandling)
void LoadSchemaFromLocation(string uri, string url)
XsdValidator(BaseValidator validator)
void LoadSchema(string uri, string url)
SchemaElementDecl FastGetElementDecl(object particle)
static bool ToBoolean(string s)
virtual ? string LookupPrefix(string uri)
virtual IDictionary< string, string > GetNamespacesInScope(XmlNamespaceScope scope)
virtual void AddNamespace(string prefix, string uri)
static readonly XmlQualifiedName Empty
void Init(string name, string ns)
bool AddDefaultAttribute(SchemaAttDef attdef)
override XmlNamespaceManager NamespaceManager