Beispiel #1
0
 /// <summary>
 /// This <c>validateAttribute</c> method performs a validation
 /// of the provided node object using a delegate converter. This is
 /// typically another <c>Composite</c> converter, or if the
 /// node is an attribute a <c>Primitive</c> converter. If this
 /// fails validation then an exception is thrown to report the issue.
 /// </summary>
 /// <param name="node">
 /// this is the node that contains the contact value
 /// </param>
 /// <param name="map">
 /// this is the map that contains the label objects
 /// </param>
 public void ValidateAttribute(InputNode node, LabelMap map) {
    Position line = node.getPosition();
    String name = node.GetName();
    Label label = map.take(name);
    if(label == null) {
       if(map.IsStrict(context) && revision.IsEqual()) {
          throw new AttributeException("Attribute '%s' does not exist at %s", name, line);
       }
    } else {
       Validate(node, label);
    }
 }
Beispiel #2
0
 /// <summary>
 /// This <c>validateElement</c> method performs a validation
 /// of the provided node object using a delegate converter. This is
 /// typically another <c>Composite</c> converter, or if the
 /// node is an attribute a <c>Primitive</c> converter. If this
 /// fails validation then an exception is thrown to report the issue.
 /// </summary>
 /// <param name="node">
 /// this is the node that contains the contact value
 /// </param>
 /// <param name="map">
 /// this is the map that contains the label objects
 /// </param>
 public void ValidateElement(InputNode node, LabelMap map) {
    String name = node.GetName();
    Label label = map.take(name);
    if(label == null) {
       label = criteria.Get(name);
    }
    if(label == null) {
       Position line = node.getPosition();
       if(map.IsStrict(context) && revision.IsEqual()) {
          throw new ElementException("Element '%s' does not exist at %s", name, line);
       } else {
          node.skip();
       }
    } else {
       Validate(node, label);
    }
 }
Beispiel #3
0
 /// <summary>
 /// This <c>readElement</c> method is used for deserialization
 /// of the provided node object using a delegate converter. This is
 /// typically another <c>Composite</c> converter, or if the
 /// node is an attribute a <c>Primitive</c> converter. When
 /// the delegate converter has completed the deserialized value is
 /// assigned to the contact.
 /// </summary>
 /// <param name="node">
 /// this is the node that contains the contact value
 /// </param>
 /// <param name="source">
 /// the type of the object that is being deserialized
 /// </param>
 /// <param name="map">
 /// this is the map that contains the label objects
 /// </param>
 public void ReadElement(InputNode node, Object source, LabelMap map) {
    String name = node.GetName();
    Label label = map.take(name);
    if(label == null) {
       label = criteria.Get(name);
    }
    if(label == null) {
       Position line = node.getPosition();
       Class type = source.getClass();
       if(map.IsStrict(context) && revision.IsEqual()) {
          throw new ElementException("Element '%s' does not have a match in %s at %s", name, type, line);
       } else {
          node.skip();
       }
    } else {
       Read(node, source, label);
    }
 }