Show / Hide Table of Contents

Class RdfAParserBase<THtmlDocument, TElement, TNode, TAttribute>

Base class for the framework-specific RDFa parser implementations.

Inheritance
System.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

| Improve this Doc 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()
| Improve this Doc 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

| Improve this Doc View Source

HtmlPlusRdfA10Version

RDFa Version Constants.

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

HtmlPlusRdfA11Version

RDFa Version Constants.

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

RdfANamespace

Namespace URI for RDFa.

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

XHtmlNamespace

Namespace URI for XHTML.

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

XHtmlPlusRdfA10Version

RDFa Version Constants.

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

XHtmlPlusRdfA11Version

RDFa Version Constants.

Declaration
public const string XHtmlPlusRdfA11Version = "XHTML+RDFa 1.1"
Field Value
Type Description
string
| Improve this Doc 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
| Improve this Doc View Source

XHtmlVocabNamespace

XHTML Vocab Namespace.

Declaration
public const string XHtmlVocabNamespace = "http://www.w3.org/1999/xhtml/vocab#"
Field Value
Type Description
string

Methods

| Improve this Doc 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.

| Improve this Doc 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
| Improve this Doc 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
System.Collections.Generic.IEnumerable<T><TAttribute>
| Improve this Doc 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
| Improve this Doc 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
| Improve this Doc 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
System.Collections.Generic.IEnumerable<T><TNode>
| Improve this Doc 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
| Improve this Doc 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
| Improve this Doc 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
| Improve this Doc 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
| Improve this Doc 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
System.Text.StringBuilder output
TNode node
| Improve this Doc 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
System.Boolean

True if the element has an attribute named attributeName, false otherwise.

| Improve this Doc 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
System.Boolean

True if the element has children, false otherwise.

| Improve this Doc 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
System.Boolean

True if node is a text node, false otherwise.

| Improve this Doc View Source

IsXmlBaseIsPermissible(THtmlDocument)

Deterine 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
System.Boolean
| Improve this Doc 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.

System.IO.StreamReader input

Stream to read from.

| Improve this Doc 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.

System.IO.TextReader input

Input to read from.

| Improve this Doc 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.

| Improve this Doc 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.

System.IO.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.

System.IO.IOException

Thrown if the Parser encounters an IO Error while trying to access/parse the Stream.

| Improve this Doc 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.

System.IO.StreamReader input

Stream to read from.

| Improve this Doc 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.

System.IO.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.

System.IO.IOException

Thrown if the Parser encounters an IO Error while trying to access/parse the Stream.

| Improve this Doc 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.

System.IO.TextReader input

Input to read from.

| Improve this Doc 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.

| Improve this Doc 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.

| Improve this Doc View Source

LoadAndParse(TextReader)

Parse the input stream as an HTML document.

Declaration
protected abstract THtmlDocument LoadAndParse(TextReader input)
Parameters
Type Name Description
System.IO.TextReader input
Returns
Type Description
THtmlDocument
| Improve this Doc 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
| Improve this Doc 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 currElement)
Parameters
Type Name Description
RdfAParserContext<THtmlDocument> context
RdfAEvaluationContext evalContext
TElement currElement
| Improve this Doc 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

| Improve this Doc 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)
  • Improve this Doc
  • View Source
In This Article
  • Constructors
    • RdfAParserBase()
    • RdfAParserBase(RdfASyntax)
  • Fields
    • HtmlPlusRdfA10Version
    • HtmlPlusRdfA11Version
    • RdfANamespace
    • XHtmlNamespace
    • XHtmlPlusRdfA10Version
    • XHtmlPlusRdfA11Version
    • XHtmlPlusRdfADoctype
    • XHtmlVocabNamespace
  • Methods
    • GetAttribute(TElement, string)
    • GetAttributeName(TAttribute)
    • GetAttributes(TElement)
    • GetAttributeValue(TAttribute)
    • GetBaseElement(THtmlDocument)
    • GetChildren(TElement)
    • GetElementName(TElement)
    • GetHtmlElement(THtmlDocument)
    • GetInnerHtml(TElement)
    • GetInnerText(TNode)
    • GrabText(StringBuilder, TNode)
    • HasAttribute(TElement, string)
    • HasChildren(TElement)
    • IsTextNode(TNode)
    • IsXmlBaseIsPermissible(THtmlDocument)
    • Load(IGraph, StreamReader)
    • Load(IGraph, TextReader)
    • Load(IGraph, string)
    • Load(IRdfHandler, StreamReader, IUriFactory)
    • Load(IRdfHandler, StreamReader)
    • Load(IRdfHandler, TextReader, IUriFactory)
    • Load(IRdfHandler, TextReader)
    • Load(IRdfHandler, string, IUriFactory)
    • Load(IRdfHandler, string)
    • 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