本文整理汇总了C#中System.Xml.XmlQualifiedName.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# XmlQualifiedName.Equals方法的具体用法?C# XmlQualifiedName.Equals怎么用?C# XmlQualifiedName.Equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlQualifiedName
的用法示例。
在下文中一共展示了XmlQualifiedName.Equals方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetBuiltInComplexType
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;
}
示例2: MatchEnumeration
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;
}
示例3: CheckChoiceType
bool CheckChoiceType (XmlQualifiedName typeQName, XmlSchemaParticle particle, ArrayList types, ref bool multiValue)
{
XmlQualifiedName type = null;
multiValue = multiValue || particle.MaxOccurs > 1;
if (particle is XmlSchemaGroupRef)
return CheckChoiceType (typeQName, GetRefGroupParticle ((XmlSchemaGroupRef)particle), types, ref multiValue);
if (particle is XmlSchemaElement) {
string ns;
XmlSchemaElement elem = (XmlSchemaElement)particle;
XmlSchemaElement refElem = GetRefElement (typeQName, elem, out ns);
if (refElem.SchemaType != null) return true;
type = refElem.SchemaTypeName;
}
else if (particle is XmlSchemaAny) {
type = anyType;
}
else if (particle is XmlSchemaSequence)
{
XmlSchemaSequence seq = particle as XmlSchemaSequence;
foreach (XmlSchemaParticle par in seq.Items)
if (!CheckChoiceType (typeQName, par, types, ref multiValue)) return false;
return true;
}
else if (particle is XmlSchemaChoice)
{
foreach (XmlSchemaParticle choice in ((XmlSchemaChoice)particle).Items)
if (!CheckChoiceType (typeQName, choice, types, ref multiValue)) return false;
return true;
}
if (typeQName.Equals (type)) return false;
// For primitive types, compare using CLR types, since several
// xml types can be mapped to a single CLR type
string t;
if (IsPrimitiveTypeNamespace (type.Namespace))
t = TypeTranslator.GetPrimitiveTypeData (type.Name).FullTypeName + ":" + type.Namespace;
else
t = type.Name + ":" + type.Namespace;
if (types.Contains (t)) return false;
types.Add (t);
return true;
}
示例4: CanBeArray
bool CanBeArray (XmlQualifiedName typeQName, XmlSchemaParticle particle, bool multiValue)
{
// To be an array, there can't be a direct child of type typeQName
if (particle == null) return false;
multiValue = multiValue || particle.MaxOccurs > 1;
if (particle is XmlSchemaGroupRef)
return CanBeArray (typeQName, GetRefGroupParticle ((XmlSchemaGroupRef)particle), multiValue);
if (particle is XmlSchemaElement)
{
XmlSchemaElement elem = (XmlSchemaElement)particle;
if (!elem.RefName.IsEmpty)
return CanBeArray (typeQName, FindRefElement (elem), multiValue);
else
return multiValue && !typeQName.Equals (((XmlSchemaElement)particle).SchemaTypeName);
}
if (particle is XmlSchemaAny)
return multiValue;
if (particle is XmlSchemaSequence)
{
XmlSchemaSequence seq = particle as XmlSchemaSequence;
if (seq.Items.Count != 1) return false;
return CanBeArray (typeQName, (XmlSchemaParticle)seq.Items[0], multiValue);
}
if (particle is XmlSchemaChoice)
{
// Can be array if all choices have different types
ArrayList types = new ArrayList ();
if(!CheckChoiceType (typeQName, particle, types, ref multiValue)) return false;
return multiValue;
}
return false;
}
示例5: FastGetElementDecl
private SchemaElementDecl FastGetElementDecl(XmlQualifiedName elementName, object particle)
{
SchemaElementDecl elementDecl = null;
if (particle != null)
{
XmlSchemaElement element = particle as XmlSchemaElement;
if (element != null)
{
elementDecl = element.ElementDecl;
}
else
{
XmlSchemaAny any = (XmlSchemaAny) particle;
this.processContents = any.ProcessContentsCorrect;
}
}
if ((elementDecl != null) || (this.processContents == XmlSchemaContentProcessing.Skip))
{
return elementDecl;
}
if (this.isRoot && (this.partialValidationType != null))
{
if (this.partialValidationType is XmlSchemaElement)
{
XmlSchemaElement partialValidationType = (XmlSchemaElement) this.partialValidationType;
if (elementName.Equals(partialValidationType.QualifiedName))
{
return partialValidationType.ElementDecl;
}
this.SendValidationEvent("Sch_SchemaElementNameMismatch", elementName.ToString(), partialValidationType.QualifiedName.ToString());
return elementDecl;
}
if (this.partialValidationType is XmlSchemaType)
{
XmlSchemaType type = (XmlSchemaType) this.partialValidationType;
return type.ElementDecl;
}
this.SendValidationEvent("Sch_ValidateElementInvalidCall", string.Empty);
return elementDecl;
}
return this.compiledSchemaInfo.GetElementDecl(elementName);
}
示例6: MatchEnumeration
private bool MatchEnumeration(XmlQualifiedName value, ArrayList enumeration, XmlSchemaDatatype datatype)
{
foreach (XmlQualifiedName correctValue in enumeration)
{
if (value.Equals(correctValue))
{
return true;
}
}
return false;
}
示例7: FindElement
/// <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)
{
foreach (XmlSchemaElement element in schema.Elements.Values) {
if (name.Equals(element.QualifiedName)) {
return element;
}
}
return null;
}
示例8: FastGetElementDecl
private SchemaElementDecl FastGetElementDecl(XmlQualifiedName elementName, object particle) {
SchemaElementDecl elementDecl = null;
if (particle != null) {
XmlSchemaElement element = particle as XmlSchemaElement;
if (element != null) {
elementDecl = element.ElementDecl;
}
else {
XmlSchemaAny any = (XmlSchemaAny)particle;
processContents = any.ProcessContentsCorrect;
}
}
if (elementDecl == null && processContents != XmlSchemaContentProcessing.Skip) {
if (isRoot && partialValidationType != null) {
if (partialValidationType is XmlSchemaElement) {
XmlSchemaElement element = (XmlSchemaElement)partialValidationType;
if (elementName.Equals(element.QualifiedName)) {
elementDecl = element.ElementDecl;
}
else {
SendValidationEvent(Res.Sch_SchemaElementNameMismatch, elementName.ToString(), element.QualifiedName.ToString());
}
}
else if (partialValidationType is XmlSchemaType) { //Element name is wildcard
XmlSchemaType type = (XmlSchemaType)partialValidationType;
elementDecl = type.ElementDecl;
}
else { //its XmlSchemaAttribute
Debug.Assert(partialValidationType is XmlSchemaAttribute);
SendValidationEvent(Res.Sch_ValidateElementInvalidCall, string.Empty);
}
}
else {
elementDecl = compiledSchemaInfo.GetElementDecl(elementName);
}
}
return elementDecl;
}
示例9: GetAttributeXsd
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;
}
示例10: FindElement
/// <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;
}
示例11: DeleteSpannedAnnotations
/// <summary>
/// Finds and removes all annotations of the specified type that have part or the entire
/// anchor covered by the start-end range. If the delete range is adjacent to the anchor it
/// it will not be deleted
/// </summary>
/// <param name="service">service to use for this operation</param>
/// <param name="annotationType">type of the annotations to be removed</param>
private static void DeleteSpannedAnnotations(AnnotationService service, XmlQualifiedName annotationType)
{
CheckInputs(service);
// Limited set of annotation types supported in V1
Invariant.Assert(annotationType != null &&
(annotationType == HighlightComponent.TypeName ||
annotationType == StickyNoteControl.TextSchemaName ||
annotationType == StickyNoteControl.InkSchemaName), "Invalid Annotation Type");
// Get the selection from the viewer
ITextSelection selection = GetTextSelection((FrameworkElement)service.Root);
Invariant.Assert(selection != null, "TextSelection is null");
// Get annotations spanned by current selection
IList<IAttachedAnnotation> attachedAnnotations = GetSpannedAnnotations(service);
// Find the annotations that overlap with the selection
foreach (IAttachedAnnotation attachedAnnot in attachedAnnotations)
{
if (annotationType.Equals(attachedAnnot.Annotation.AnnotationType))
{
// Only annotations with TextRange anchors can be compared to
// the text selection, we ignore others
TextAnchor anchor = attachedAnnot.AttachedAnchor as TextAnchor;
if (anchor == null)
continue;
// Remove any annotations that overlap in anyway
if (((selection.Start.CompareTo(anchor.Start) > 0) && (selection.Start.CompareTo(anchor.End) < 0)) ||
((selection.End.CompareTo(anchor.Start) > 0) && (selection.End.CompareTo(anchor.End) < 0)) ||
((selection.Start.CompareTo(anchor.Start) <= 0) && (selection.End.CompareTo(anchor.End) >= 0)) ||
CheckCaret(selection, anchor, annotationType))
{
service.Store.DeleteAnnotation(attachedAnnot.Annotation.Id);
}
}
}
}