Class HtmlWriter
Class for saving RDF Graphs to a XHTML Table format with the actual Triples embedded as RDFa.
Inherited Members
Namespace: VDS.RDF.Writing
Assembly: dotNetRdf.dll
Syntax
public class HtmlWriter : BaseHtmlWriter, IHtmlWriter, IRdfWriter, INamespaceWriter
Remarks
Since not all Triples can be embedded into XHTML those Triples will not have RDFa generated for them but all Triples will be shown in a human readable format. Triples that can be serialized are roughly equivalent to anything that can be serialized in Turtle i.e. URI/BNode subject, URI predicates and URI/BNode/Literal object.
If you encode Triples which have values datatyped as XML Literals with this writer then round-trip Graph equality is not guaranteed as the RDFa parser will add appropriate Namespace declarations to elements as required by the specification.
Properties
| Improve this Doc View SourceDefaultNamespaces
Gets/Sets the Default Namespaces to use for writers.
Declaration
public INamespaceMapper DefaultNamespaces { get; set; }
Property Value
Type | Description |
---|---|
INamespaceMapper |
Remarks
Since not all Triples can be embedded into XHTML those Triples will not have RDFa generated for them but all Triples will be shown in a human readable format. Triples that can be serialized are roughly equivalent to anything that can be serialized in Turtle i.e. URI/BNode subject, URI predicates and URI/BNode/Literal object.
If you encode Triples which have values datatyped as XML Literals with this writer then round-trip Graph equality is not guaranteed as the RDFa parser will add appropriate Namespace declarations to elements as required by the specification.
Methods
| Improve this Doc View SourceSave(IGraph, TextWriter, bool)
Save the Graph to the given Stream as an XHTML Table with embedded RDFa.
Declaration
public void Save(IGraph g, TextWriter output, bool leaveOpen)
Parameters
Type | Name | Description |
---|---|---|
IGraph | g | Graph to save. |
System.IO.TextWriter | output | Stream to save to. |
System.Boolean | leaveOpen | Whether to leave |
Remarks
Since not all Triples can be embedded into XHTML those Triples will not have RDFa generated for them but all Triples will be shown in a human readable format. Triples that can be serialized are roughly equivalent to anything that can be serialized in Turtle i.e. URI/BNode subject, URI predicates and URI/BNode/Literal object.
If you encode Triples which have values datatyped as XML Literals with this writer then round-trip Graph equality is not guaranteed as the RDFa parser will add appropriate Namespace declarations to elements as required by the specification.
Save(IGraph, TextWriter)
Method for Saving a Graph to a Concrete RDF Syntax via some arbitrary System.IO.TextWriter.
Declaration
public void Save(IGraph g, TextWriter output)
Parameters
Type | Name | Description |
---|---|---|
IGraph | g | The Graph to Save. |
System.IO.TextWriter | output | The System.IO.TextWriter to save the Graph to. |
Remarks
Since not all Triples can be embedded into XHTML those Triples will not have RDFa generated for them but all Triples will be shown in a human readable format. Triples that can be serialized are roughly equivalent to anything that can be serialized in Turtle i.e. URI/BNode subject, URI predicates and URI/BNode/Literal object.
If you encode Triples which have values datatyped as XML Literals with this writer then round-trip Graph equality is not guaranteed as the RDFa parser will add appropriate Namespace declarations to elements as required by the specification.
Exceptions
Type | Condition |
---|---|
RdfException | Thrown if the RDF in the Graph is not representable by the Writer. |
System.IO.IOException | Thrown if the Writer is unable to write to the underlying storage of the System.IO.TextWriter specified in the |
Save(IGraph, string, Encoding)
Method for saving a graph to a concrete RDF syntax in a file-based format with a specific text encoding.
Declaration
public void Save(IGraph g, string filename, Encoding fileEncoding)
Parameters
Type | Name | Description |
---|---|---|
IGraph | g | The graph to save. |
string | filename | The path to the file to write to. |
System.Text.Encoding | fileEncoding | The text encoding to use when writing the file content. |
Remarks
Since not all Triples can be embedded into XHTML those Triples will not have RDFa generated for them but all Triples will be shown in a human readable format. Triples that can be serialized are roughly equivalent to anything that can be serialized in Turtle i.e. URI/BNode subject, URI predicates and URI/BNode/Literal object.
If you encode Triples which have values datatyped as XML Literals with this writer then round-trip Graph equality is not guaranteed as the RDFa parser will add appropriate Namespace declarations to elements as required by the specification.
Exceptions
Type | Condition |
---|---|
RdfException | Thrown if the RDF in the Graph is not representable by the Writer. |
System.IO.IOException | Thrown if the Writer is unable to write to the File. |
Save(IGraph, string)
Method for Saving a Graph to a Concrete RDF Syntax in a file based format.
Declaration
public void Save(IGraph g, string filename)
Parameters
Type | Name | Description |
---|---|---|
IGraph | g | The Graph to Save. |
string | filename | The filename to save the Graph in. |
Remarks
The output will be written in UTF-8 with no byte-order mark specified. To override this behaviour, call either Save(IGraph, string, Encoding) with the specific encoding to use, or Save(IGraph, TextWriter) with a TextWriter created with the required text encoding set.
Exceptions
Type | Condition |
---|---|
RdfException | Thrown if the RDF in the Graph is not representable by the Writer. |
System.IO.IOException | Thrown if the Writer is unable to write to the File. |
ToString()
Gets the String representation of the writer which is a description of the syntax it produces.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string |
Overrides
Remarks
Since not all Triples can be embedded into XHTML those Triples will not have RDFa generated for them but all Triples will be shown in a human readable format. Triples that can be serialized are roughly equivalent to anything that can be serialized in Turtle i.e. URI/BNode subject, URI predicates and URI/BNode/Literal object.
If you encode Triples which have values datatyped as XML Literals with this writer then round-trip Graph equality is not guaranteed as the RDFa parser will add appropriate Namespace declarations to elements as required by the specification.
Events
| Improve this Doc View SourceWarning
Event which is raised if there is a non-fatal error with the RDF being output
Declaration
public event RdfWriterWarning Warning
Event Type
Type | Description |
---|---|
RdfWriterWarning |
Remarks
Since not all Triples can be embedded into XHTML those Triples will not have RDFa generated for them but all Triples will be shown in a human readable format. Triples that can be serialized are roughly equivalent to anything that can be serialized in Turtle i.e. URI/BNode subject, URI predicates and URI/BNode/Literal object.
If you encode Triples which have values datatyped as XML Literals with this writer then round-trip Graph equality is not guaranteed as the RDFa parser will add appropriate Namespace declarations to elements as required by the specification.