Пример #1
0
 /// <summary>
 /// This method is used to write the version attribute. A version is
 /// written only if it is not the initial version or if it required.
 /// The version is used to determine how to deserialize the XML. If
 /// the version is different from the expected version then it allows
 /// the object to be deserialized in a manner that does not require
 /// any attributes or elements, and unmatched nodes are ignored.
 /// </summary>
 /// <param name="node">
 /// this is the node to read the version attribute from
 /// </param>
 /// <param name="source">
 /// this is the source object that is to be written
 /// </param>
 /// <param name="schema">
 /// this is the schema that contains the version
 /// </param>
 public void WriteVersion(OutputNode node, Object source, Schema schema) {
    Version version = schema.getRevision();
    Label label = schema.GetVersion();
    if(version != null) {
       Double start = revision.Default;
       Double value = version.revision();
       if(revision.Compare(value, start)) {
          if(label.isRequired()) {
             WriteAttribute(node, value, label);
          }
       } else {
          WriteAttribute(node, value, label);
       }
    }
 }