public class RDFXMLWriter extends AbstractRDFWriter implements RDFWriter
Modifier and Type | Field and Description |
---|---|
protected ParsedIRI |
baseIRI |
protected String |
defaultNamespace |
protected boolean |
entityQuote |
protected boolean |
headerWritten |
protected Resource |
lastWrittenSubject |
protected char |
quote |
protected Writer |
writer |
protected boolean |
writingStarted |
namespaceTable
Constructor and Description |
---|
RDFXMLWriter(OutputStream out)
Creates a new RDFXMLWriter that will write to the supplied OutputStream.
|
RDFXMLWriter(OutputStream out,
ParsedIRI baseIRI)
Creates a new RDFXMLWriter that will write to the supplied OutputStream.
|
RDFXMLWriter(Writer writer)
Creates a new RDFXMLWriter that will write to the supplied Writer.
|
RDFXMLWriter(Writer writer,
ParsedIRI baseIRI)
Creates a new RDFXMLWriter that will write to the supplied Writer.
|
Modifier and Type | Method and Description |
---|---|
void |
endRDF()
Signals the end of the RDF data.
|
protected void |
flushPendingStatements() |
RDFFormat |
getRDFFormat()
Gets the RDF format that this RDFWriter uses.
|
protected String |
getValidNodeId(BNode bNode)
Create a syntactically valid node id from the supplied blank node id.
|
void |
handleComment(String comment)
Handles a comment.
|
void |
handleNamespace(String prefix,
String name)
Handles a namespace declaration/definition.
|
void |
handleStatement(Statement st)
Handles a statement.
|
protected void |
setNamespace(String prefix,
String name) |
void |
startRDF()
Signals the start of the RDF data.
|
protected void |
writeAttribute(String attName,
String value) |
protected void |
writeAttribute(String namespace,
String attName,
String value) |
protected void |
writeCharacterData(String chars)
Replace special characters in text with entities.
|
protected void |
writeEndOfEmptyTag()
Write > or />
|
protected void |
writeEndOfStartTag()
Write >
|
protected void |
writeEndTag(String namespace,
String localName) |
protected void |
writeHeader() |
protected void |
writeIndent()
Write tab
|
protected void |
writeNewLine()
Write newline character
|
protected void |
writeQuotedAttribute(String attName,
String value)
Write quoted attribute
|
protected void |
writeStartOfStartTag(String namespace,
String localName) |
getSupportedSettings, getWriterConfig, set, setWriterConfig
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSupportedSettings, getWriterConfig, set, setWriterConfig
protected ParsedIRI baseIRI
protected Writer writer
protected String defaultNamespace
protected boolean writingStarted
protected boolean headerWritten
protected Resource lastWrittenSubject
protected char quote
protected boolean entityQuote
public RDFXMLWriter(OutputStream out)
out
- The OutputStream to write the RDF/XML document to.public RDFXMLWriter(OutputStream out, ParsedIRI baseIRI)
out
- The OutputStream to write the RDF/XML document to.baseIRI
- base URIpublic RDFXMLWriter(Writer writer)
writer
- The Writer to write the RDF/XML document to.public RDFFormat getRDFFormat()
RDFWriter
getRDFFormat
in interface RDFWriter
public void startRDF() throws RDFHandlerException
RDFHandler
startRDF
in interface RDFHandler
RDFHandlerException
- If the RDF handler has encountered an unrecoverable error.protected void writeHeader() throws IOException
IOException
public void endRDF() throws RDFHandlerException
RDFHandler
endRDF
in interface RDFHandler
RDFHandlerException
- If the RDF handler has encountered an unrecoverable error.public void handleNamespace(String prefix, String name)
RDFHandler
handleNamespace
in interface RDFHandler
handleNamespace
in class AbstractRDFWriter
prefix
- The prefix for the namespace, or an empty string in case of a default namespace.name
- The URI that the prefix maps to.public void handleStatement(Statement st) throws RDFHandlerException
RDFHandler
handleStatement
in interface RDFHandler
st
- The statement.RDFHandlerException
- If the RDF handler has encountered an unrecoverable error.public void handleComment(String comment) throws RDFHandlerException
RDFHandler
handleComment
in interface RDFHandler
comment
- The comment.RDFHandlerException
- If the RDF handler has encountered an unrecoverable error.protected void flushPendingStatements() throws IOException, RDFHandlerException
IOException
RDFHandlerException
protected void writeStartOfStartTag(String namespace, String localName) throws IOException
IOException
protected void writeAttribute(String attName, String value) throws IOException
IOException
protected void writeAttribute(String namespace, String attName, String value) throws IOException, RDFHandlerException
IOException
RDFHandlerException
protected void writeQuotedAttribute(String attName, String value) throws IOException
attName
- attribute namevalue
- string valueIOException
protected void writeEndOfStartTag() throws IOException
IOException
protected void writeEndOfEmptyTag() throws IOException
IOException
protected void writeEndTag(String namespace, String localName) throws IOException
IOException
protected void writeCharacterData(String chars) throws IOException
chars
- textIOException
protected void writeIndent() throws IOException
IOException
protected void writeNewLine() throws IOException
IOException
protected String getValidNodeId(BNode bNode) throws IOException
bNode
- a blank node identifierIOException
Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.