Validate() public method

This validate method will validate the primitive by checking the node text. If the value is a reference then this will not extract any value from the node. Transformation of the extracted value is not done as it can not account for template variables. Thus any text extracted is valid.
public Validate ( InputNode node ) : bool
node InputNode /// this is the node to be validated as a primitive ///
return bool
Example #1
0
        /// <summary>
        /// This method is used to read the key value from the node. The
        /// value read from the node is resolved using the template filter.
        /// If the key value can not be found according to the annotation
        /// attributes then the node is considered as null and is valid.
        /// </summary>
        /// <param name="node">
        /// this is the node to read the key value from
        /// </param>
        /// <param name="key">
        /// this is the name of the attribute used by the key
        /// </param>
        /// <returns>
        /// this returns the value deserialized from the node
        /// </returns>
        public bool ValidateAttribute(InputNode node, String key)
        {
            String    name  = style.GetElement(key);
            InputNode child = node.GetAttribute(name);

            if (child == null)
            {
                return(true);
            }
            return(root.Validate(child));
        }
Example #2
0
 /// <summary>
 /// This <c>validate</c> method will validate the XML element list
 /// from the provided node and validate its children as entry types.
 /// This will validate each entry type as a primitive value. In order
 /// to do this the parent string provided forms the element.
 /// </summary>
 /// <param name="node">
 /// this is the XML element that is to be deserialized
 /// </param>
 /// <param name="type">
 /// this is the type to validate against the input node
 /// </param>
 /// <returns>
 /// true if the element matches the XML schema class given
 /// </returns>
 public bool Validate(InputNode node, Class type)
 {
     while (true)
     {
         InputNode next = node.getNext();
         if (next == null)
         {
             return(true);
         }
         root.Validate(next);
     }
 }
Example #3
0
 /// <summary>
 /// This <c>validate</c> method wll validate the XML element list
 /// from the provided node and validate its children as entry types.
 /// This will validate each entry type as a primitive value. In order
 /// to do this the parent string provided forms the element.
 /// </summary>
 /// <param name="node">
 /// this is the XML element that is to be validated
 /// </param>
 /// <param name="type">
 /// this is the array type used to create the array
 /// </param>
 /// <returns>
 /// true if the element matches the XML schema class given
 /// </returns>
 public bool Validate(InputNode node, Class type)
 {
     for (int i = 0; true; i++)
     {
         InputNode next = node.getNext();
         if (next == null)
         {
             return(true);
         }
         root.Validate(next);
     }
 }
Example #4
0
        /// <summary>
        /// This method is used to read the value value from the node. The
        /// value read from the node is resolved using the template filter.
        /// If the value value can not be found according to the annotation
        /// attributes then null is assumed and the node is valid.
        /// </summary>
        /// <param name="node">
        /// this is the node to read the value object from
        /// </param>
        /// <param name="key">
        /// this is the name of the node to be validated
        /// </param>
        /// <returns>
        /// this returns true if the primitive key is valid
        /// </returns>
        public bool Validate(InputNode node, String key)
        {
            String name = style.GetAttribute(key);

            if (!entry.IsInline())
            {
                node = node.getNext(name);
                if (node == null)
                {
                    return(true);
                }
            }
            return(root.Validate(node));
        }
Example #5
0
        /// <summary>
        /// This <c>read</c> method wll read the XML element list from
        /// the provided node and deserialize its children as entry types.
        /// This will deserialize each entry type as a primitive value. In
        /// order to do this the parent string provided forms the element.
        /// </summary>
        /// <param name="node">
        /// this is the XML element that is to be deserialized
        /// </param>
        /// <returns>
        /// this returns the item to attach to the object contact
        /// </returns>
        public bool Validate(InputNode node)
        {
            InputNode from = node.getParent();
            String    name = node.getName();

            while (node != null)
            {
                bool valid = root.Validate(node);
                if (valid == false)
                {
                    return(false);
                }
                node = from.getNext(name);
            }
            return(true);
        }