Show / Hide Table of Contents

Class RdfAParserBase<THtmlDocument, TElement, TNode, TAttribute>

Base class for the framework-specific RDFa parser implementations.

Inheritance
object
RdfAParserBase<THtmlDocument, TElement, TNode, TAttribute>
RdfAParser
Implements
IRdfReader
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
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 Source

RdfAParserBase()

Creates a new RDFa Parser which will auto-detect which RDFa version to use (assumes 1.1 if none explicitly specified).

Declaration
protected RdfAParserBase()
| Edit this page View Source

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.

| Edit this page View Source

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 Source

HtmlPlusRdfA10Version

RDFa Version Constants.

Declaration
public const string HtmlPlusRdfA10Version = "HTML+RDFa 1.0"
Field Value
Type Description
string
| Edit this page View Source

HtmlPlusRdfA11Version

RDFa Version Constants.

Declaration
public const string HtmlPlusRdfA11Version = "HTML+RDFa 1.1"
Field Value
Type Description
string
| Edit this page View Source

RdfANamespace

Namespace URI for RDFa.

Declaration
public const string RdfANamespace = "http://www.w3.org/ns/rdfa#"
Field Value
Type Description
string
| Edit this page View Source

XHtmlNamespace

Namespace URI for XHTML.

Declaration
public const string XHtmlNamespace = "http://www.w3.org/1999/xhtml"
Field Value
Type Description
string
| Edit this page View Source

XHtmlPlusRdfA10Version

RDFa Version Constants.

Declaration
public const string XHtmlPlusRdfA10Version = "XHTML+RDFa 1.0"
Field Value
Type Description
string
| Edit this page View Source

XHtmlPlusRdfA11Version

RDFa Version Constants.

Declaration
public const string XHtmlPlusRdfA11Version = "XHTML+RDFa 1.1"
Field Value
Type Description
string
| Edit this page View Source

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
| Edit this page View Source

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 Source

GetAttribute(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.

| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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>
| Edit this page View Source

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
| Edit this page View Source

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>
| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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 attributeName, false otherwise.

| Edit this page View Source

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.

| Edit this page View Source

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 node is an element node, false otherwise.

| Edit this page View Source

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 node is a root node, false otherwise.

| Edit this page View Source

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 node is a text node, false otherwise.

| Edit this page View Source

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
| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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 Source

Warning

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

Implements

IRdfReader

Extension Methods

Extensions.ToSafeString(object)
Extensions.AsEnumerable<T>(T)
  • Edit this page
  • View Source
In this article
  • Constructors
    • RdfAParserBase()
    • RdfAParserBase(RdfAParserOptions)
    • RdfAParserBase(RdfASyntax)
  • Fields
    • HtmlPlusRdfA10Version
    • HtmlPlusRdfA11Version
    • RdfANamespace
    • XHtmlNamespace
    • XHtmlPlusRdfA10Version
    • XHtmlPlusRdfA11Version
    • XHtmlPlusRdfADoctype
    • XHtmlVocabNamespace
  • Methods
    • GetAttribute(TElement, string)
    • GetAttributeName(TAttribute)
    • GetAttributeValue(TAttribute)
    • GetAttributes(TElement)
    • GetBaseElement(THtmlDocument)
    • GetChildren(TElement)
    • GetElementName(TElement)
    • GetHtmlElement(THtmlDocument)
    • GetInnerHtml(TElement)
    • GetInnerText(TNode)
    • GrabText(StringBuilder, TNode)
    • HasAttribute(TElement, string)
    • HasChildren(TElement)
    • IsElement(TNode)
    • IsRoot(TNode)
    • IsTextNode(TNode)
    • IsXmlBaseIsPermissible(THtmlDocument)
    • Load(IGraph, StreamReader)
    • Load(IGraph, TextReader)
    • Load(IGraph, string)
    • Load(IRdfHandler, StreamReader)
    • Load(IRdfHandler, StreamReader, IUriFactory)
    • Load(IRdfHandler, TextReader)
    • Load(IRdfHandler, TextReader, IUriFactory)
    • Load(IRdfHandler, string)
    • Load(IRdfHandler, string, IUriFactory)
    • LoadAndParse(TextReader)
    • ProcessDocument(RdfAParserContext<THtmlDocument>, RdfAEvaluationContext)
    • ProcessElement(RdfAParserContext<THtmlDocument>, RdfAEvaluationContext, TElement)
    • SetAttribute(TElement, string, string)
  • Events
    • Warning
  • Implements
  • Extension Methods
Back to top Generated by DocFX