/// <include file='doc\XmlSchemaType.uex' path='docs/doc[@for="XmlSchemaType.GetXsdComplexType"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public static XmlSchemaComplexType GetBuiltInComplexType(XmlQualifiedName qualifiedName) { if (qualifiedName == null) { throw new ArgumentNullException("qualifiedName"); } if (qualifiedName.Equals(XmlSchemaComplexType.AnyType.QualifiedName)) { return XmlSchemaComplexType.AnyType; } if (qualifiedName.Equals(XmlSchemaComplexType.UntypedAnyType.QualifiedName)) { return XmlSchemaComplexType.UntypedAnyType; } return null; }
internal void AddTemplate(TemplateAction template) { Debug.Assert(template != null); Debug.Assert( ((object)_mode == (object?)template.Mode) || (template.Mode == null && _mode.Equals(XmlQualifiedName.Empty)) || _mode.Equals(template.Mode) ); this.templates ??= new ArrayList(); this.templates.Add(template); }
private bool IsInfiniteRecursiveLoop(TreeNode parent, XmlQualifiedName qname) { if (qname.IsEmpty) { return(false); } TreeNode ancestor = parent; int count = 0; while (ancestor != null) { if (ancestor.Tag != null && ancestor.Tag is NodeData) { XmlQualifiedName aqname = ((NodeData)ancestor.Tag).Name; if (aqname.Equals(qname)) { ++count; } } ancestor = ancestor.Parent; } if (count > 1) { int aaa = 0; } return(count > 1); }
/// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public static XmlSchemaComplexType?GetBuiltInComplexType(XmlQualifiedName qualifiedName) { ArgumentNullException.ThrowIfNull(qualifiedName); if (qualifiedName.Equals(XmlSchemaComplexType.AnyType.QualifiedName)) { return(XmlSchemaComplexType.AnyType); } if (qualifiedName.Equals(XmlSchemaComplexType.UntypedAnyType.QualifiedName)) { return(XmlSchemaComplexType.UntypedAnyType); } return(null); }
/// <include file='doc\XmlSchemaType.uex' path='docs/doc[@for="XmlSchemaType.GetXsdComplexType"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public static XmlSchemaComplexType GetBuiltInComplexType(XmlQualifiedName qualifiedName) { if (qualifiedName == null) { throw new ArgumentNullException("qualifiedName"); } if (qualifiedName.Equals(XmlSchemaComplexType.AnyType.QualifiedName)) { return(XmlSchemaComplexType.AnyType); } if (qualifiedName.Equals(XmlSchemaComplexType.UntypedAnyType.QualifiedName)) { return(XmlSchemaComplexType.UntypedAnyType); } return(null); }
/// <summary> /// A qualified name is considered equal if the namespace and /// name are the same. The prefix is ignored. /// </summary> public override bool Equals(object obj) { QualifiedName qualifiedName = obj as QualifiedName; if (qualifiedName != null) { return(xmlQualifiedName.Equals(qualifiedName.xmlQualifiedName)); } else { XmlQualifiedName name = obj as XmlQualifiedName; if (name != null) { return(xmlQualifiedName.Equals(name)); } } return(false); }
private bool MatchEnumeration(XmlQualifiedName value, ArrayList enumeration) { for (int i = 0; i < enumeration.Count; i++) { if (value.Equals((XmlQualifiedName)enumeration[i])) { return(true); } } return(false); }
private XmlSchemaType BaseType(XmlSchemaComplexType ct) { XmlSchemaType baseType = ct.BaseXmlSchemaType; XmlQualifiedName baseTypeName = baseType.QualifiedName; if (baseType.TypeCode == XmlTypeCode.Item || baseTypeName.Equals(ct.QualifiedName) || baseType is XmlSchemaSimpleType) { //Dont add inheritance hierarchy if deriving from schema simple types or anyType return(null); } return(baseType); }
private bool MatchEnumeration(XmlQualifiedName value, ArrayList enumeration, XmlSchemaDatatype datatype) { foreach (XmlQualifiedName correctValue in enumeration) { if (value.Equals(correctValue)) { return(true); } } return(false); }
/// <summary> /// A qualified name is considered equal if the namespace and /// name are the same. The prefix is ignored. /// </summary> public override bool Equals(object obj) { bool equals = false; QualifiedName qualifiedName = obj as QualifiedName; if (qualifiedName != null) { equals = xmlQualifiedName.Equals(qualifiedName.xmlQualifiedName); } else { XmlQualifiedName name = obj as XmlQualifiedName; if (name != null) { equals = xmlQualifiedName.Equals(name); } } return(equals); }
/// <summary> /// Finds an element in the schema. /// </summary> /// <remarks> /// Only looks at the elements that are defined in the /// root of the schema so it will not find any elements /// that are defined inside any complex types. /// </remarks> XmlSchemaElement FindElement(XmlQualifiedName name) { XmlSchemaElement matchedElement = null; foreach (XmlSchemaElement element in schema.Elements.Values) { if (name.Equals(element.QualifiedName)) { matchedElement = element; break; } } return(matchedElement); }
private bool MatchEnumeration(XmlQualifiedName value, ArrayList enumeration, XmlSchemaDatatype datatype) { bool flag; foreach (XmlQualifiedName correctValue in enumeration) { if (value.Equals(correctValue)) { flag = true; return(flag); } } flag = false; return(flag); }
private XmlSchemaType BaseType(XmlSchemaComplexType ct) { XmlSchemaType xmlSchemaType; XmlSchemaType baseType = ct.BaseXmlSchemaType; XmlQualifiedName baseTypeName = baseType.QualifiedName; if ((baseType.TypeCode == XmlTypeCode.Item || baseTypeName.Equals(ct.QualifiedName) ? false : !(baseType is XmlSchemaSimpleType))) { xmlSchemaType = baseType; } else { xmlSchemaType = null; } return(xmlSchemaType); }
private bool Accepts(ContentNode node, XmlQualifiedName qname, int positions, Object index) { if (index != null) { BitSet first = node.Firstpos(positions); for (int i = 0; i < first.Count; i++) { if (first.Get(i) && qname.Equals(((TerminalNode)terminalNodes[i]).Name)) { return(true); } } return(false); } else { return(node.Accepts(qname)); } }
// Token: 0x060062D7 RID: 25303 RVA: 0x001BBC34 File Offset: 0x001B9E34 private static void DeleteSpannedAnnotations(AnnotationService service, XmlQualifiedName annotationType) { AnnotationHelper.CheckInputs(service); Invariant.Assert(annotationType != null && (annotationType == HighlightComponent.TypeName || annotationType == StickyNoteControl.TextSchemaName || annotationType == StickyNoteControl.InkSchemaName), "Invalid Annotation Type"); ITextSelection textSelection = AnnotationHelper.GetTextSelection((FrameworkElement)service.Root); Invariant.Assert(textSelection != null, "TextSelection is null"); IList <IAttachedAnnotation> spannedAnnotations = AnnotationHelper.GetSpannedAnnotations(service); foreach (IAttachedAnnotation attachedAnnotation in spannedAnnotations) { if (annotationType.Equals(attachedAnnotation.Annotation.AnnotationType)) { TextAnchor textAnchor = attachedAnnotation.AttachedAnchor as TextAnchor; if (textAnchor != null && ((textSelection.Start.CompareTo(textAnchor.Start) > 0 && textSelection.Start.CompareTo(textAnchor.End) < 0) || (textSelection.End.CompareTo(textAnchor.Start) > 0 && textSelection.End.CompareTo(textAnchor.End) < 0) || (textSelection.Start.CompareTo(textAnchor.Start) <= 0 && textSelection.End.CompareTo(textAnchor.End) >= 0) || AnnotationHelper.CheckCaret(textSelection, textAnchor, annotationType))) { service.Store.DeleteAnnotation(attachedAnnotation.Annotation.Id); } } } }
public SchemaAttDef GetAttributeXsd(SchemaElementDecl ed, XmlQualifiedName qname, XmlSchemaObject partialValidationType, out AttributeMatchState attributeMatchState) { SchemaAttDef attdef = null; attributeMatchState = AttributeMatchState.UndeclaredAttribute; if (ed != null) { attdef = ed.GetAttDef(qname); if (attdef != null) { attributeMatchState = AttributeMatchState.AttributeFound; return attdef; } XmlSchemaAnyAttribute any = ed.AnyAttribute; if (any != null) { if (!any.NamespaceList.Allows(qname)) { attributeMatchState = AttributeMatchState.ProhibitedAnyAttribute; } else if (any.ProcessContentsCorrect != XmlSchemaContentProcessing.Skip) { attdef = (SchemaAttDef)attributeDecls[qname]; if (attdef != null) { if (attdef.Datatype.TypeCode == XmlTypeCode.Id) { //anyAttribute match whose type is ID attributeMatchState = AttributeMatchState.AnyIdAttributeFound; } else { attributeMatchState = AttributeMatchState.AttributeFound; } } else if (any.ProcessContentsCorrect == XmlSchemaContentProcessing.Lax) { attributeMatchState = AttributeMatchState.AnyAttributeLax; } } else { attributeMatchState = AttributeMatchState.AnyAttributeSkip; } } else if (ed.ProhibitedAttributes[qname] != null) { attributeMatchState = AttributeMatchState.ProhibitedAttribute; } } else if (partialValidationType != null) { XmlSchemaAttribute attr = partialValidationType as XmlSchemaAttribute; if (attr != null) { if (qname.Equals(attr.QualifiedName)) { attdef = attr.AttDef; attributeMatchState = AttributeMatchState.AttributeFound; } else { attributeMatchState = AttributeMatchState.AttributeNameMismatch; } } else { attributeMatchState = AttributeMatchState.ValidateAttributeInvalidCall; } } else { attdef = (SchemaAttDef)attributeDecls[qname]; if (attdef != null) { attributeMatchState = AttributeMatchState.AttributeFound; } else { attributeMatchState = AttributeMatchState.UndeclaredElementAndAttribute; } } return attdef; }
internal override bool Accepts(XmlQualifiedName qname) { return(qname.Equals(name)); }
private bool MatchEnumeration(XmlQualifiedName value, ArrayList enumeration) { foreach(XmlQualifiedName correctValue in enumeration) { if (value.Equals(correctValue)) { return true; } } return false; }
internal SchemaAttDef GetAttributeXsd(SchemaElementDecl ed, XmlQualifiedName qname, XmlSchemaObject partialValidationType, out AttributeMatchState attributeMatchState) { SchemaAttDef attdef = null; attributeMatchState = AttributeMatchState.UndeclaredAttribute; if (ed != null) { attdef = ed.GetAttDef(qname); if (attdef != null) { attributeMatchState = AttributeMatchState.AttributeFound; return(attdef); } XmlSchemaAnyAttribute any = ed.AnyAttribute; if (any != null) { if (!any.NamespaceList.Allows(qname)) { attributeMatchState = AttributeMatchState.ProhibitedAnyAttribute; } else if (any.ProcessContentsCorrect != XmlSchemaContentProcessing.Skip) { if (attributeDecls.TryGetValue(qname, out attdef)) { if (attdef.Datatype.TypeCode == XmlTypeCode.Id) //anyAttribute match whose type is ID { attributeMatchState = AttributeMatchState.AnyIdAttributeFound; } else { attributeMatchState = AttributeMatchState.AttributeFound; } } else if (any.ProcessContentsCorrect == XmlSchemaContentProcessing.Lax) { attributeMatchState = AttributeMatchState.AnyAttributeLax; } } else { attributeMatchState = AttributeMatchState.AnyAttributeSkip; } } else if (ed.ProhibitedAttributes.ContainsKey(qname)) { attributeMatchState = AttributeMatchState.ProhibitedAttribute; } } else if (partialValidationType != null) { XmlSchemaAttribute attr = partialValidationType as XmlSchemaAttribute; if (attr != null) { if (qname.Equals(attr.QualifiedName)) { attdef = attr.AttDef; attributeMatchState = AttributeMatchState.AttributeFound; } else { attributeMatchState = AttributeMatchState.AttributeNameMismatch; } } else { attributeMatchState = AttributeMatchState.ValidateAttributeInvalidCall; } } else { if (attributeDecls.TryGetValue(qname, out attdef)) { attributeMatchState = AttributeMatchState.AttributeFound; } else { attributeMatchState = AttributeMatchState.UndeclaredElementAndAttribute; } } return(attdef); }
private bool Accepts(ContentNode node, XmlQualifiedName qname, int positions, Object index) { if (index != null) { BitSet first = node.Firstpos(positions); for (int i = 0; i < first.Count; i++) { if (first.Get(i) && qname.Equals(((TerminalNode)terminalNodes[i]).Name)) return true; } return false; } else { return node.Accepts(qname); } }
private bool MatchEnumeration(XmlQualifiedName value, ArrayList enumeration) { for (int i = 0; i < enumeration.Count; ++i) { if (value.Equals((XmlQualifiedName)enumeration[i])) { return true; } } return false; }
internal void Finish(ValidationEventHandler eventHandler, bool compile) { stack = null; IsCompiled = !abnormalContent && compile; if (contentNode == null) { return; } #if DEBUG StringBuilder bb = new StringBuilder(); contentNode.Dump(bb); Debug.WriteLineIf(CompModSwitches.XmlSchema.TraceVerbose, "\t\t\tContent: (" + bb.ToString() + ")"); #endif // add end node endNode = NewTerminalNode(XmlQualifiedName.Empty); contentNode = new InternalNode(contentNode, endNode, ContentNode.Type.Sequence); ((InternalNode)contentNode).LeftNode.ParentNode = contentNode; endNode.ParentNode = contentNode; if (!IsCompiled) { CheckXsdDeterministic(eventHandler); return; } if (nodeTable == null) { nodeTable = new Hashtable(); } // calculate followpos int terminals = terminalNodes.Count; BitSet[] followpos = new BitSet[terminals]; for (int i = 0; i < terminals; i++) { followpos[i] = new BitSet(terminals); } contentNode.CalcFollowpos(followpos); // state table ArrayList Dstates = new ArrayList(16); // transition table dtrans = new ArrayList(16); // lists unmarked states ArrayList unmarked = new ArrayList(16); // state lookup table Hashtable statetable = new Hashtable(); BitSet empty = new BitSet(terminals); statetable.Add(empty, -1); // start with firstpos at the root BitSet set = contentNode.Firstpos(terminals); statetable.Add(set, Dstates.Count); unmarked.Add(set); Dstates.Add(set); int[] a = new int[symbols.Count + 1]; dtrans.Add(a); if (set.Get(endNode.Pos)) { a[symbols.Count] = 1; // accepting } // current state processed int state = 0; // check all unmarked states while (unmarked.Count > 0) { int[] t = (int[])dtrans[state]; set = (BitSet)unmarked[0]; CheckDeterministic(set, terminals, eventHandler); unmarked.RemoveAt(0); // check all input symbols for (int sym = 0; sym < symbols.Count; sym++) { XmlQualifiedName n = (XmlQualifiedName)symbols[sym]; BitSet newset = new BitSet(terminals); // if symbol is in the set add followpos to new set for (int i = 0; i < terminals; i++) { if (set.Get(i) && n.Equals(((TerminalNode)terminalNodes[i]).Name)) { newset.Or(followpos[i]); } } Object lookup = statetable[newset]; // this state will transition to int transitionTo; // if new set is not in states add it if (lookup == null) { transitionTo = Dstates.Count; statetable.Add(newset, transitionTo); unmarked.Add(newset); Dstates.Add(newset); a = new int[symbols.Count + 1]; dtrans.Add(a); if (newset.Get(endNode.Pos)) { a[symbols.Count] = 1; // accepting } } else { transitionTo = (int)lookup; } // set the transition for the symbol t[sym] = transitionTo; } state++; } nodeTable = null; }