Пример #1
0
        internal AnyType GetNodeType(INode node)
        {
            var matchingElement = GetElement(node.LocalName);

            if (matchingElement == null)
            {
                return(null);
            }
            return(AnyType.CreateType(matchingElement.TypeName.Name, this));
        }
Пример #2
0
 internal AnyType GetAttributeType(IAttribute attribute)
 {
     foreach (var currentGlobalAttribute in thisXmlSchemaSet.GlobalAttributes)
     {
         var currentGlobalAttributeQualifiedName = currentGlobalAttribute.Key;
         if ((attribute.LocalName.Equals(currentGlobalAttributeQualifiedName.Name) == true) && (attribute.NamespaceURI.Equals(currentGlobalAttributeQualifiedName.Namespace) == true))
         {
             return(AnyType.CreateType(currentGlobalAttribute.Value.TypeName.Name, this));
         }
     }
     return(null);
 }
Пример #3
0
 /// <summary>
 /// Look for an attribute type amongst the schema's set of global types.
 /// </summary>
 /// <param name="attribute">
 /// The attribute whose type should be found.
 /// </param>
 /// <returns>
 /// The type for the attribute, or null if the type cannot be found.
 /// </returns>
 private AnyType GetAttributeTypeFromGlobalTypes(IAttribute attribute)
 {
     foreach (var currentGlobalType in thisXmlSchemaSet.GlobalTypes)
     {
         var currentGlobalTypeValue = currentGlobalType.Value;
         var matchingDefinition     = currentGlobalTypeValue.GetAttribute(attribute.LocalName);
         if (matchingDefinition != null)
         {
             return(AnyType.CreateType(matchingDefinition.TypeName.Name, this));
         }
     }
     return(null);
 }
Пример #4
0
        /// <summary>
        /// Gets the data type for the supplied node.
        /// </summary>
        /// <param name="node">
        /// The node whose data type is returned.
        /// </param>
        /// <returns>
        /// The data type of the supplied node. A null reference will be returned
        /// if no matching element can be found for the supplied node.
        /// </returns>
        internal AnyType GetNodeType(INode node)
        {
            var containingSchema = GetSchemaContainingElement(node.LocalName);

            if (containingSchema == null)
            {
                return(null);
            }
            var matchingElement = containingSchema.GetElement(node.LocalName);

            if (matchingElement == null)
            {
                return(null);
            }
            return(AnyType.CreateType(matchingElement.TypeName.Name, containingSchema));
        }
Пример #5
0
 /// <summary>
 /// Look for an attribute type amongst the schema's set of global elements.
 /// </summary>
 /// <param name="attribute">
 /// The attribute whose type should be found.
 /// </param>
 /// <returns>
 /// The type for the attribute, or null if the type cannot be found.
 /// </returns>
 private AnyType GetAttributeTypeFromGlobalElements(IAttribute attribute)
 {
     foreach (var currentGlobalType in thisXmlSchemaSet.GlobalElements)
     {
         var currentGlobalTypeValue = currentGlobalType.Value;
         if (currentGlobalTypeValue.Name.Equals(attribute.Node.LocalName) == true)
         {
             foreach (var currentSchemaAttribute in currentGlobalTypeValue.SchemaAttributes)
             {
                 if (currentSchemaAttribute.Name.Equals(attribute.Name) == true)
                 {
                     return(AnyType.CreateType(currentSchemaAttribute.TypeName.Name, this));
                 }
             }
         }
     }
     return(null);
 }