Class RdfAParserBase<THtmlDocument, TElement, TNode, TAttribute>
Base class for the framework-specific RDFa parser implementations.
Implements
Inherited Members
Namespace: VDS.RDF.Parsing
Assembly: dotNetRdf.dll
Syntax
public abstract class RdfAParserBase<THtmlDocument, TElement, TNode, TAttribute> : IRdfReader where TElement : class, TNode
  Type Parameters
| Name | Description | 
|---|---|
| THtmlDocument | |
| TElement | |
| TNode | |
| TAttribute | 
Constructors
| Edit this page View SourceRdfAParserBase()
Creates a new RDFa Parser which will auto-detect which RDFa version to use (assumes 1.1 if none explicitly specified).
Declaration
protected RdfAParserBase()
  RdfAParserBase(RdfAParserOptions)
Creates a new RDFa Parser configured with the provided parser options.
Declaration
protected RdfAParserBase(RdfAParserOptions options)
  Parameters
| Type | Name | Description | 
|---|---|---|
| RdfAParserOptions | options | The parser options settings.  | 
      
RdfAParserBase(RdfASyntax)
Creates a new RDFa Parser which will use the specified RDFa syntax.
Declaration
protected RdfAParserBase(RdfASyntax syntax)
  Parameters
| Type | Name | Description | 
|---|---|---|
| RdfASyntax | syntax | RDFa Syntax Version.  | 
      
Fields
| Edit this page View SourceHtmlPlusRdfA10Version
RDFa Version Constants.
Declaration
public const string HtmlPlusRdfA10Version = "HTML+RDFa 1.0"
  Field Value
| Type | Description | 
|---|---|
| string | 
HtmlPlusRdfA11Version
RDFa Version Constants.
Declaration
public const string HtmlPlusRdfA11Version = "HTML+RDFa 1.1"
  Field Value
| Type | Description | 
|---|---|
| string | 
RdfANamespace
Namespace URI for RDFa.
Declaration
public const string RdfANamespace = "http://www.w3.org/ns/rdfa#"
  Field Value
| Type | Description | 
|---|---|
| string | 
XHtmlNamespace
Namespace URI for XHTML.
Declaration
public const string XHtmlNamespace = "http://www.w3.org/1999/xhtml"
  Field Value
| Type | Description | 
|---|---|
| string | 
XHtmlPlusRdfA10Version
RDFa Version Constants.
Declaration
public const string XHtmlPlusRdfA10Version = "XHTML+RDFa 1.0"
  Field Value
| Type | Description | 
|---|---|
| string | 
XHtmlPlusRdfA11Version
RDFa Version Constants.
Declaration
public const string XHtmlPlusRdfA11Version = "XHTML+RDFa 1.1"
  Field Value
| Type | Description | 
|---|---|
| string | 
XHtmlPlusRdfADoctype
URI for the XHTML+RDFa DTD.
Declaration
public const string XHtmlPlusRdfADoctype = "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"
  Field Value
| Type | Description | 
|---|---|
| string | 
XHtmlVocabNamespace
XHTML Vocab Namespace.
Declaration
public const string XHtmlVocabNamespace = "http://www.w3.org/1999/xhtml/vocab#"
  Field Value
| Type | Description | 
|---|---|
| string | 
Methods
| Edit this page View SourceGetAttribute(TElement, string)
Get the value of a particular attribute of an element.
Declaration
protected abstract string GetAttribute(TElement element, string attributeName)
  Parameters
| Type | Name | Description | 
|---|---|---|
| TElement | element | The element.  | 
      
| string | attributeName | The name of the attribute on the element.  | 
      
Returns
| Type | Description | 
|---|---|
| string | The value of the attribute.  | 
      
GetAttributeName(TAttribute)
Get the name of an attribute.
Declaration
protected abstract string GetAttributeName(TAttribute attribute)
  Parameters
| Type | Name | Description | 
|---|---|---|
| TAttribute | attribute | 
Returns
| Type | Description | 
|---|---|
| string | 
GetAttributeValue(TAttribute)
Get the value of an attribute.
Declaration
protected abstract string GetAttributeValue(TAttribute attribute)
  Parameters
| Type | Name | Description | 
|---|---|---|
| TAttribute | attribute | 
Returns
| Type | Description | 
|---|---|
| string | 
GetAttributes(TElement)
Get all attributes of an element.
Declaration
protected abstract IEnumerable<TAttribute> GetAttributes(TElement element)
  Parameters
| Type | Name | Description | 
|---|---|---|
| TElement | element | 
Returns
| Type | Description | 
|---|---|
| IEnumerable<TAttribute> | 
GetBaseElement(THtmlDocument)
Get the base element of the specified document.
Declaration
protected abstract TElement GetBaseElement(THtmlDocument document)
  Parameters
| Type | Name | Description | 
|---|---|---|
| THtmlDocument | document | 
Returns
| Type | Description | 
|---|---|
| TElement | 
GetChildren(TElement)
Return the children of an element (in order).
Declaration
protected abstract IEnumerable<TNode> GetChildren(TElement element)
  Parameters
| Type | Name | Description | 
|---|---|---|
| TElement | element | 
Returns
| Type | Description | 
|---|---|
| IEnumerable<TNode> | 
GetElementName(TElement)
Get the name of an element.
Declaration
protected abstract string GetElementName(TElement element)
  Parameters
| Type | Name | Description | 
|---|---|---|
| TElement | element | 
Returns
| Type | Description | 
|---|---|
| string | 
GetHtmlElement(THtmlDocument)
Get the html element of the document.
Declaration
protected abstract TElement GetHtmlElement(THtmlDocument document)
  Parameters
| Type | Name | Description | 
|---|---|---|
| THtmlDocument | document | 
Returns
| Type | Description | 
|---|---|
| TElement | 
GetInnerHtml(TElement)
Get the HTML contained within an element as a string.
Declaration
protected abstract string GetInnerHtml(TElement element)
  Parameters
| Type | Name | Description | 
|---|---|---|
| TElement | element | 
Returns
| Type | Description | 
|---|---|
| string | 
GetInnerText(TNode)
Get the inner text of an element or a text node.
Declaration
protected abstract string GetInnerText(TNode node)
  Parameters
| Type | Name | Description | 
|---|---|---|
| TNode | node | 
Returns
| Type | Description | 
|---|---|
| string | 
GrabText(StringBuilder, TNode)
Get the text content of a node and add it to the provided output buffer.
Declaration
protected abstract void GrabText(StringBuilder output, TNode node)
  Parameters
| Type | Name | Description | 
|---|---|---|
| StringBuilder | output | |
| TNode | node | 
HasAttribute(TElement, string)
Determine if an element has a particular attribute.
Declaration
protected abstract bool HasAttribute(TElement element, string attributeName)
  Parameters
| Type | Name | Description | 
|---|---|---|
| TElement | element | The element to check.  | 
      
| string | attributeName | The name of the attribute to check for.  | 
      
Returns
| Type | Description | 
|---|---|
| bool | True if the element has an attribute named   | 
      
HasChildren(TElement)
Determine if an element has children.
Declaration
protected abstract bool HasChildren(TElement element)
  Parameters
| Type | Name | Description | 
|---|---|---|
| TElement | element | 
Returns
| Type | Description | 
|---|---|
| bool | True if the element has children, false otherwise.  | 
      
IsElement(TNode)
Determine if a node in the parsed HTML document tree is an element node.
Declaration
protected abstract bool IsElement(TNode node)
  Parameters
| Type | Name | Description | 
|---|---|---|
| TNode | node | The node to evaluate.  | 
      
Returns
| Type | Description | 
|---|---|
| bool | True if   | 
      
IsRoot(TNode)
Determine if a node in the parsed HTML document tree is the root document node.
Declaration
protected abstract bool IsRoot(TNode node)
  Parameters
| Type | Name | Description | 
|---|---|---|
| TNode | node | The node to evaluate.  | 
      
Returns
| Type | Description | 
|---|---|
| bool | True if   | 
      
IsTextNode(TNode)
Determine if a node in the parsed Html document tree is a text node.
Declaration
protected abstract bool IsTextNode(TNode node)
  Parameters
| Type | Name | Description | 
|---|---|---|
| TNode | node | 
Returns
| Type | Description | 
|---|---|
| bool | True if   | 
      
IsXmlBaseIsPermissible(THtmlDocument)
Determine if the HTML document can have an xml:base element.
Declaration
protected abstract bool IsXmlBaseIsPermissible(THtmlDocument document)
  Parameters
| Type | Name | Description | 
|---|---|---|
| THtmlDocument | document | 
Returns
| Type | Description | 
|---|---|
| bool | 
Load(IGraph, StreamReader)
Parses RDFa by extracting it from the HTML from the given input.
Declaration
public void Load(IGraph g, StreamReader input)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IGraph | g | Graph to load into.  | 
      
| StreamReader | input | Stream to read from.  | 
      
Load(IGraph, TextReader)
Parses RDFa by extracting it from the HTML from the given input.
Declaration
public void Load(IGraph g, TextReader input)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IGraph | g | Graph to load into.  | 
      
| TextReader | input | Input to read from.  | 
      
Load(IGraph, string)
Parses RDFa by extracting it from the HTML from the given file.
Declaration
public void Load(IGraph g, string filename)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IGraph | g | Graph to load into.  | 
      
| string | filename | File to read from.  | 
      
Load(IRdfHandler, StreamReader)
Parses RDFa by extracting it from the HTML from the given input.
Declaration
public void Load(IRdfHandler handler, StreamReader input)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IRdfHandler | handler | RDF Handler to use.  | 
      
| StreamReader | input | Stream to read from.  | 
      
Load(IRdfHandler, StreamReader, IUriFactory)
Method for Loading RDF using a RDF Handler from some Concrete RDF Syntax via some arbitrary Stream.
Declaration
public void Load(IRdfHandler handler, StreamReader input, IUriFactory uriFactory)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IRdfHandler | handler | RDF Handler to use.  | 
      
| StreamReader | input | The reader to read input from.  | 
      
| IUriFactory | uriFactory | URI factory to use.  | 
      
Exceptions
| Type | Condition | 
|---|---|
| RdfException | Thrown if the Parser tries to output something that is invalid RDF.  | 
      
| RdfParseException | Thrown if the Parser cannot Parse the Input.  | 
      
| IOException | Thrown if the Parser encounters an IO Error while trying to access/parse the Stream.  | 
      
Load(IRdfHandler, TextReader)
Parses RDFa by extracting it from the HTML from the given input.
Declaration
public void Load(IRdfHandler handler, TextReader input)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IRdfHandler | handler | RDF Handler to use.  | 
      
| TextReader | input | Input to read from.  | 
      
Load(IRdfHandler, TextReader, IUriFactory)
Method for Loading RDF using a RDF Handler from some Concrete RDF Syntax via some arbitrary Stream.
Declaration
public void Load(IRdfHandler handler, TextReader input, IUriFactory uriFactory)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IRdfHandler | handler | RDF Handler to use.  | 
      
| TextReader | input | The reader to read input from.  | 
      
| IUriFactory | uriFactory | URI factory to use.  | 
      
Exceptions
| Type | Condition | 
|---|---|
| RdfException | Thrown if the Parser tries to output something that is invalid RDF.  | 
      
| RdfParseException | Thrown if the Parser cannot Parse the Input.  | 
      
| IOException | Thrown if the Parser encounters an IO Error while trying to access/parse the Stream.  | 
      
Load(IRdfHandler, string)
Parses RDFa by extracting it from the HTML from the given input.
Declaration
public void Load(IRdfHandler handler, string filename)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IRdfHandler | handler | RDF Handler to use.  | 
      
| string | filename | File to read from.  | 
      
Load(IRdfHandler, string, IUriFactory)
Parses RDFa by extracting it from the HTML from the given input.
Declaration
public void Load(IRdfHandler handler, string filename, IUriFactory uriFactory)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IRdfHandler | handler | RDF Handler to use.  | 
      
| string | filename | File to read from.  | 
      
| IUriFactory | uriFactory | URI Factory to use.  | 
      
LoadAndParse(TextReader)
Parse the input stream as an HTML document.
Declaration
protected abstract THtmlDocument LoadAndParse(TextReader input)
  Parameters
| Type | Name | Description | 
|---|---|---|
| TextReader | input | 
Returns
| Type | Description | 
|---|---|
| THtmlDocument | 
ProcessDocument(RdfAParserContext<THtmlDocument>, RdfAEvaluationContext)
Process the content of an HTML document.
Declaration
protected abstract void ProcessDocument(RdfAParserContext<THtmlDocument> context, RdfAEvaluationContext evalContext)
  Parameters
| Type | Name | Description | 
|---|---|---|
| RdfAParserContext<THtmlDocument> | context | |
| RdfAEvaluationContext | evalContext | 
ProcessElement(RdfAParserContext<THtmlDocument>, RdfAEvaluationContext, TElement)
Process the content of an element of the document.
Declaration
protected void ProcessElement(RdfAParserContext<THtmlDocument> context, RdfAEvaluationContext evalContext, TElement currentElement)
  Parameters
| Type | Name | Description | 
|---|---|---|
| RdfAParserContext<THtmlDocument> | context | |
| RdfAEvaluationContext | evalContext | |
| TElement | currentElement | 
SetAttribute(TElement, string, string)
Set the value of a particular attribute of an element.
Declaration
protected abstract void SetAttribute(TElement element, string attributeName, string value)
  Parameters
| Type | Name | Description | 
|---|---|---|
| TElement | element | The element.  | 
      
| string | attributeName | The name of the attribute to set/update.  | 
      
| string | value | The new value for the attribute.  | 
      
Events
| Edit this page View SourceWarning
Event which is raised when there is a non-fatal error with the input being read
Declaration
public event RdfReaderWarning Warning
  Event Type
| Type | Description | 
|---|---|
| RdfReaderWarning |