SemWeb : SemWeb Namespace
RdfXmlWriter Class

Writes RDF statements to an RDF/XML file.

public class RdfXmlWriter : RdfWriter


Remarks

The RdfXmlWriter buffers the entire output document in memory, before writing the document to the stream when Close is called.

The namespaces used in the output data must be registered with the NamespaceManager in the SemWeb.RdfWriter.Namespaces property before the first call to Add. Failure to do so may prevent the document from being written to the stream, as not all URIs can be automatically converted into an XML qualified name.

The following example writes out RDF statements in RDF/XML format to a file:

C# Example
using (RdfXmlWriter output = new RdfXmlWriter("filename.rdf")) {
    output.Namespaces.AddNamespace("http://xmlns.com/foaf/0.1/", "foaf");
    output.BaseUri = "http://www.example.org/";
    output.Write(datasource);
}  

All constructors for the RdfXmlWriter have a couterpart with an additional parameter for a SemWeb.RdfXmlWriter.Options object that specifies formatting parameters for the output. When an Options object is not used, SemWeb.RdfXmlWriter.Options.Full is used. This parameter can be used with the SemWeb.RdfXmlWriter.Options.XMP field to ensure the resulting XML document conforms to the Adobe XMP specification.

Members

See Also: Inherited members from RdfWriter.

Constructors

Creates an RDF/XML writer that writes to the given TextWriter.
Creates an RDF/XML writer that writes to the named file.
Creates an RDF/XML writer that writes to the given XmlDocument.
Creates an RDF/XML writer that writes to the given XmlWriter.
Creates an RDF/XML writer that writes to the given TextWriter with output style options.
Creates an RDF/XML writer that writes to the named file with output style options.
Creates an RDF/XML writer that writes to the given XmlDocument with output style options.
Creates an RDF/XML writer that writes to the given XmlWriter with output style options.

Properties

BaseUri
string . Gets or sets the base URI for the output document. (Inherited from RdfWriter.)
Namespaces [read-only]
abstract
NamespaceManager . The NamespaceManager that manages namespace URIs and their prefixes. (Inherited from RdfWriter.)

Methods

abstract Add (Statement)
Writes a statement to the stream. (Inherited from RdfWriter.)
Close ()
Completes writing the data and closes the stream. (Inherited from RdfWriter.)
Write (StatementSource)
Writes out the contents of the StatementSource. (Inherited from RdfWriter.)

Protected Methods

Member Details

RdfXmlWriter Constructor

public RdfXmlWriter (string file)

Creates an RDF/XML writer that writes to the named file.

Parameters

file
A file name, or "-" for standard output.

Remarks

None.

RdfXmlWriter Constructor

public RdfXmlWriter (System.IO.TextWriter writer)

Creates an RDF/XML writer that writes to the given TextWriter.

Parameters

writer
A TextWriter.

Remarks

None.

RdfXmlWriter Constructor

public RdfXmlWriter (System.Xml.XmlWriter writer)

Creates an RDF/XML writer that writes to the given XmlWriter.

Parameters

writer
An XmlWriter.

Remarks

None.

RdfXmlWriter Constructor

public RdfXmlWriter (System.Xml.XmlDocument dest)

Creates an RDF/XML writer that writes to the given XmlDocument.

Parameters

dest
A new, empty XmlDocument.

Remarks

The document must be empty.

RdfXmlWriter Constructor

public RdfXmlWriter (string file, RdfXmlWriter.Options style)

Creates an RDF/XML writer that writes to the named file with output style options.

Parameters

file
A file name, or "-" for standard output.
style
An instance of SemWeb.RdfXmlWriter.Options providing options for how the output document should be formatted.

Remarks

None.

RdfXmlWriter Constructor

public RdfXmlWriter (System.IO.TextWriter writer, RdfXmlWriter.Options style)

Creates an RDF/XML writer that writes to the given TextWriter with output style options.

Parameters

writer
A TextWriter.
style
An instance of SemWeb.RdfXmlWriter.Options providing options for how the output document should be formatted.

Remarks

None.

RdfXmlWriter Constructor

public RdfXmlWriter (System.Xml.XmlDocument dest, RdfXmlWriter.Options style)

Creates an RDF/XML writer that writes to the given XmlDocument with output style options.

Parameters

dest
A new, empty XmlDocument.
style
An instance of SemWeb.RdfXmlWriter.Options providing options for how the output document should be formatted.

Remarks

None.

RdfXmlWriter Constructor

public RdfXmlWriter (System.Xml.XmlWriter writer, RdfXmlWriter.Options style)

Creates an RDF/XML writer that writes to the given XmlWriter with output style options.

Parameters

writer
An XmlWriter.
style
An instance of SemWeb.RdfXmlWriter.Options providing options for how the output document should be formatted.

Remarks

None.