public Validate ( InputNode node, Class type ) : bool | ||
node | InputNode | /// this provides the source of the XML document /// |
type | Class | /// this is the class type to be validated against XML /// |
리턴 | bool |
/// <summary> /// This <c>validate</c> method will validate the XML element /// list from the provided node and deserialize its children as entry /// types. This takes each entry type and validates it as a root type, /// that is, its <c>Root</c> annotation must be present and the /// name of the entry element must match that root element name. /// </summary> /// <param name="node"> /// this is the XML element that is to be validated /// </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(); Class expect = entry.Type; if (next == null) { return(true); } root.Validate(next, expect); } }
/// <summary> /// This <c>validate</c> method wll validate the XML element /// list against the provided node and validate its children as entry /// types. This ensures each entry type is validated as a root type, /// that is, its <c>Root</c> annotation must be present and the /// name of the entry element must match that root element name. /// </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); } if (!next.isEmpty()) { root.Validate(next, type); } } }
/// <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)); }
/// <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 each entry type is deserialized as a root type, that /// is, its <c>Root</c> annotation must be present and the /// name of the entry element must match that root element name. /// </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(); Class type = entry.Type; String name = node.GetName(); while (node != null) { bool valid = root.Validate(node, type); if (valid == false) { return(false); } node = from.getNext(name); } return(true); }