org.openrdf.rio.rdfxml
Class RdfXmlWriter

java.lang.Object
  extended byorg.openrdf.rio.rdfxml.RdfXmlWriter
All Implemented Interfaces:
RdfDocumentWriter
Direct Known Subclasses:
AbbreviatedRdfXmlWriter

public class RdfXmlWriter
extends Object
implements RdfDocumentWriter

An implementation of the RdfDocumentWriter interface that writes RDF documents in XML-serialized RDF format.


Constructor Summary
RdfXmlWriter(OutputStream out)
          Creates a new RdfXmlWriter that will write to the supplied OutputStream.
RdfXmlWriter(Writer out)
          Creates a new RdfXmlWriter that will write to the supplied Writer.
 
Method Summary
 void addStyleSheet(String href, String type)
           
 void addStyleSheet(String href, String type, String title, String media, String charset, boolean alternate)
          Associate a stylesheet with this XML document.
 void endDocument()
          Ends the document writing.
 void setNamespace(String prefix, String name)
          Sets a mapping from a namespace prefix to a namespace name.
 void startDocument()
          Starts the document writing.
 void writeComment(String comment)
          Writes a comment to the document.
 void writeStatement(Resource subj, URI pred, Value obj)
          Writes a statement to the document.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RdfXmlWriter

public RdfXmlWriter(OutputStream out)
Creates a new RdfXmlWriter that will write to the supplied OutputStream.

Parameters:
out - The OutputStream to write the RDF/XML document to.

RdfXmlWriter

public RdfXmlWriter(Writer out)
Creates a new RdfXmlWriter that will write to the supplied Writer.

Parameters:
out - The Writer to write the RDF/XML document to.
Method Detail

setNamespace

public void setNamespace(String prefix,
                         String name)
Description copied from interface: RdfDocumentWriter
Sets a mapping from a namespace prefix to a namespace name. Some implementations of this interface may require that namespace are set before the document writing starts (i.e. before startDocument() is called). Note that a mapping can only be defined once for a given namespace name. The RdfDocumentWriter will ignore an attempt to define a mapping for a namespace it already has a mapping for.

Specified by:
setNamespace in interface RdfDocumentWriter

startDocument

public void startDocument()
                   throws IOException
Description copied from interface: RdfDocumentWriter
Starts the document writing.

Specified by:
startDocument in interface RdfDocumentWriter
Throws:
IOException

endDocument

public void endDocument()
                 throws IOException
Description copied from interface: RdfDocumentWriter
Ends the document writing.

Specified by:
endDocument in interface RdfDocumentWriter
Throws:
IOException

writeStatement

public void writeStatement(Resource subj,
                           URI pred,
                           Value obj)
                    throws IOException
Description copied from interface: RdfDocumentWriter
Writes a statement to the document. The startDocument() method should have been called before.

Specified by:
writeStatement in interface RdfDocumentWriter
Throws:
IOException

writeComment

public void writeComment(String comment)
                  throws IOException
Description copied from interface: RdfDocumentWriter
Writes a comment to the document. An implementation may ignore these calls if the format doesn't support comments.

Specified by:
writeComment in interface RdfDocumentWriter
Throws:
IOException

addStyleSheet

public void addStyleSheet(String href,
                          String type,
                          String title,
                          String media,
                          String charset,
                          boolean alternate)
Associate a stylesheet with this XML document. See the relevant W3C Recommendation for an explanation of the parameters.

Parameters:
href - Required stylesheet attribute
type - Required stylesheet attribute
title - Optional stylesheet attribute
media - Optional stylesheet attribute
charset - Optional stylesheet attribute
alternate - Optional stylesheet attribute

addStyleSheet

public void addStyleSheet(String href,
                          String type)


Copyright © 2002-2006 Aduna BV, GNU LGPL License applies.