示例#1
0
        private bool IsMatchOnXsiType(IXmlIdentity xmlIdentity)
        {
            var otherXsiType = xmlIdentity.XsiType;

            return(otherXsiType == XmlName.Empty ||
                   otherXsiType == XsiType);
        }
示例#2
0
        private bool IsMatch(IXmlIdentity xmlIdentity)
        {
            var name = xmlIdentity.Name;

            return(NameComparer.Equals(rootLocalName, name.LocalName) &&
                   (rootNamespaceUri == null || NameComparer.Equals(rootNamespaceUri, name.NamespaceUri)));
        }
示例#3
0
        private bool ShouldIgnoreAttributeNamespaceUri(IXmlIdentity xmlName)
        {
            var xmlNode = xmlName as IXmlNode;

            return(xmlNode != null &&
                   xmlNode.IsAttribute &&
                   0 == (state & States.ConfiguredNamespaceUri));
        }
示例#4
0
        internal static Exception CannotSetAttribute(IXmlIdentity identity)
        {
            var message = string.Format(
                "Cannot set attribute on node '{0}'.",
                identity.Name.ToString()
                );

            return(new InvalidOperationException(message));
        }
示例#5
0
        private bool IsMatchOnNamespaceUri(IXmlIdentity xmlIdentity)
        {
            var otherNamespaceUri = xmlIdentity.Name.NamespaceUri;

            if (Context.IsReservedNamespaceUri(otherNamespaceUri))
            {
                return(NameComparer.Equals(namespaceUri, otherNamespaceUri));
            }
            return(namespaceUri == null ||
                   ShouldIgnoreAttributeNamespaceUri(xmlIdentity) ||
                   NameComparer.Equals(namespaceUri, otherNamespaceUri));
        }
示例#6
0
 protected virtual bool IsMatch(IXmlIdentity xmlIdentity)
 {
     return(NameComparer.Equals(localName, xmlIdentity.Name.LocalName) &&
            IsMatchOnNamespaceUri(xmlIdentity) &&
            IsMatchOnXsiType(xmlIdentity));
 }
示例#7
0
 public bool TryGet(IXmlIdentity xmlName, out IXmlKnownType knownType)
 {
     return(IsMatch(xmlName)
                                 ? Try.Success(out knownType, this)
                                 : Try.Failure(out knownType));
 }
示例#8
0
 public bool TryGet(IXmlIdentity xmlIdentity, out IXmlKnownType knownType)
 {
     return(itemsByXmlIdentity.TryGetValue(xmlIdentity, out knownType));
 }
示例#9
0
 public void AddIdentify(IXmlIdentity xmlIdentity)
 {
     _xmlIdentities.Add(xmlIdentity);
 }