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
| Improve this Doc 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(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 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
| Improve this Doc 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 |
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> |
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 |
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 |
---|---|
System.Collections.Generic.IEnumerable<T><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 |
---|---|---|
System.Text.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 |
---|---|
System.Boolean | 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 |
---|---|
System.Boolean | True if the element has children, false otherwise. |
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 |
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 |
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. |
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. |
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, 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. |
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. |
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. |
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. |
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. |
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. |
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 |
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 currElement)
Parameters
Type | Name | Description |
---|---|---|
RdfAParserContext<THtmlDocument> | context | |
RdfAEvaluationContext | evalContext | |
TElement | currElement |
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 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 |