Пример #1
0
 /// <summary>
 /// Checks whether an attribute is an rdf:datatype attribute.
 /// </summary>
 /// <param name="attr">Attribute to Test.</param>
 /// <param name="namespaceMapper">The namespace prefix mappings to use when expanding the namespace prefix of the attribute.</param>
 /// <returns>True if is an rdf:datatype attribute.</returns>
 public static bool IsDataTypeAttribute(AttributeEvent attr, INestedNamespaceMapper namespaceMapper)
 {
     // QName must be rdf:datatype
     if (namespaceMapper.HasNamespace(attr.Namespace) && namespaceMapper.GetNamespaceUri(attr.Namespace).ToString().Equals(NamespaceMapper.RDF) && attr.LocalName.Equals("datatype"))
     {
         // Must be a valid RDF Uri Reference
         return(IsRdfUriReference(attr.Value));
     }
     else
     {
         return(false);
     }
 }
Пример #2
0
 /// <summary>
 /// Checks whether an attribute is an rdf:ID attribute.
 /// </summary>
 /// <param name="attr">Attribute to Test.</param>
 /// <param name="nsMapper">The namespace prefix mappings to use when expanding the namespace prefix of the attribute.</param>
 /// <returns>True if is an rdf:ID attribute.</returns>
 /// <remarks>Does some validation on ID value but other validation occurs at other points in the Parsing.</remarks>
 public static bool IsIDAttribute(AttributeEvent attr, INestedNamespaceMapper nsMapper)
 {
     // QName must be rdf:id
     if (nsMapper.HasNamespace(attr.Namespace) &&
         nsMapper.GetNamespaceUri(attr.Namespace).ToString().Equals(NamespaceMapper.RDF) &&
         attr.LocalName.Equals("ID"))
     {
         // Must be a valid RDF ID
         if (IsRdfID(attr.Value))
         {
             // OK
             return(true);
         }
         else
         {
             // Invalid RDF ID so Error
             throw ParserHelper.Error("The value '" + attr.Value + "' for rdf:ID is not valid, RDF IDs can only be valid NCNames as defined by the W3C XML Namespaces specification", attr);
         }
     }
     else
     {
         return(false);
     }
 }
Пример #3
0
 /// <summary>
 /// Checks whether an attribute is an rdf:parseType attribute.
 /// </summary>
 /// <param name="attr">Attribute to Test.</param>
 /// <param name="nsMapper">The namespace prefix mappings to use when expanding the namespace prefix of the attribute.</param>
 /// <returns>True if is an rdf:parseType attribute.</returns>
 public static bool IsParseTypeAttribute(AttributeEvent attr, INestedNamespaceMapper nsMapper)
 {
     return(nsMapper.HasNamespace(attr.Namespace) &&
            nsMapper.GetNamespaceUri(attr.Namespace).ToString().Equals(NamespaceMapper.RDF) &&
            attr.LocalName.Equals("parseType"));
 }