Exemplo n.º 1
0
 public TypeRef ReadTypeRef(Element element, XPathNavigator node)
 {
     TypeRef typeref = new TypeRef();
     typeref.Code = Value(node, "f:code/@value");
     typeref.ProfileName = OptionalValue(node, "f:profile/@value");
     return typeref;
 }
Exemplo n.º 2
0
        public void ValidateTypeRef(Element element, TypeRef typeref)
        {

            // Test if the Surrect was able to link to the target structure.
            if (typeref.Structure != null)
            {
                report.Add("Reference", Kind.Valid, "Type reference to structure [{0}] is valid", typeref.Code);
                
                // Genest structuren valideren hoeft niet. Want alle structures worden al op hoofdniveau gevalideerd
                //ValidateStructure(typeref.Structure);

            }

            // Test if there is a reference at all
            else if (typeref.Code == null)
            {
                report.Add("Reference", Kind.Failed, "Missing a reference to a structure in element [{0}]", element.Name);
            }

            // Test if code is itself valid? If so, the reference valid but the target is missing.
            else if (Regex.IsMatch(typeref.Code, "[A-Za-z][A-Za-z0-9]*"))
            {
                // Collect first to avoid duplicates
                missingStructureNames.Add(typeref.Code);
            }

            // The code contains invalid characters
            else
            {
                report.Add("Reference", Kind.Failed, "Invalid structure reference '{0}' in {1}", typeref.Code, element.Path);
            }
        }
Exemplo n.º 3
0
 public bool Match(TypeRef typeref)
 {
     if (Element.Multi)
     {
         string code = ExtractTypeFromNode();
         return (typeref.Code.ToLower() == code.ToLower());
     }
     else return true;
 }