コード例 #1
0
ファイル: CompositeValue.cs プロジェクト: restlet/simplexml
        /// <summary>
        /// This method is used to read the value object from the node. The
        /// value read from the node is resolved using the template filter.
        /// If the value data can not be found according to the annotation
        /// attributes then null is assumed and returned.
        /// </summary>
        /// <param name="node">
        /// this is the node to read the value object from
        /// </param>
        /// <returns>
        /// this returns the value deserialized from the node
        /// </returns>
        public Object Read(InputNode node)
        {
            InputNode next   = node.getNext();
            Class     expect = type.Type;

            if (next == null)
            {
                return(null);
            }
            if (next.IsEmpty())
            {
                return(null);
            }
            return(root.Read(next, expect));
        }
コード例 #2
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 null is assumed and the node 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 key wrapper XML element
        /// </param>
        /// <returns>
        /// this returns the value deserialized from the node
        /// </returns>
        public bool Validate(InputNode node, String key)
        {
            String    name   = style.GetElement(key);
            InputNode next   = node.getNext(name);
            Class     expect = type.Type;

            if (next == null)
            {
                return(true);
            }
            if (next.IsEmpty())
            {
                return(true);
            }
            return(root.Validate(next, expect));
        }
コード例 #3
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 null is assumed and returned.
        /// </summary>
        /// <param name="node">
        /// this is the node to read the key value from
        /// </param>
        /// <param name="key">
        /// this is the name of the key wrapper XML element
        /// </param>
        /// <returns>
        /// this returns the value deserialized from the node
        /// </returns>
        public Object Read(InputNode node, String key)
        {
            String name   = style.GetElement(key);
            Class  expect = type.Type;

            if (name != null)
            {
                node = node.getNext(name);
            }
            if (node == null)
            {
                return(null);
            }
            if (node.IsEmpty())
            {
                return(null);
            }
            return(root.Read(node, expect));
        }
コード例 #4
0
ファイル: CompositeKey.cs プロジェクト: ngallagher/simplexml
 /// <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 null is assumed and returned.
 /// </summary>
 /// <param name="node">
 /// this is the node to read the key value from
 /// </param>
 /// <param name="key">
 /// this is the name of the key wrapper XML element
 /// </param>
 /// <returns>
 /// this returns the value deserialized from the node
 /// </returns>
 public Object Read(InputNode node, String key) {
    String name = style.GetElement(key);
    Class expect = type.Type;
    if(name != null) {
       node = node.getNext(name);
    }
    if(node == null) {
       return null;
    }
    if(node.IsEmpty()) {
       return null;
    }
    return root.Read(node, expect);
 }