Class RDFXMLWriter

    • Field Detail

      • mWriter

        protected final java.io.Writer mWriter
      • mOptions

        protected final Options mOptions
      • defaultNamespace

        protected java.lang.String defaultNamespace
      • writingStarted

        protected boolean writingStarted
      • headerWritten

        protected boolean headerWritten
      • lastWrittenSubject

        protected Resource lastWrittenSubject
      • namespaceTable

        protected java.util.Map<java.lang.String,​java.lang.String> namespaceTable
    • Constructor Detail

      • RDFXMLWriter

        public RDFXMLWriter​(java.io.OutputStream theStream,
                            Options theOptions)
    • Method Detail

      • writeHeader

        protected void writeHeader()
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • end

        public void end()
                 throws WritingFailed
        Signals the writing process is completed. The underlying InputStream is *not* closed, but the caller should not call additional methods on this writer as that will normally yield syntax errors in the output.
        Specified by:
        end in interface RDFHandler
        Specified by:
        end in interface RDFWriter
        Throws:
        WritingFailed
      • namespace

        public void namespace​(@Nonnull
                              java.lang.String prefix,
                              @Nonnull
                              java.lang.String name)
        Provide a namespace to the writer. This method can be called before writing has started, in which case, the namespace bindings are buffered and written when appropriate after writing has begun.
        Specified by:
        namespace in interface RDFHandler
        Specified by:
        namespace in interface RDFWriter
        Parameters:
        prefix - the namespace prefix
        name - the associated IRI
      • setNamespace

        protected java.lang.String setNamespace​(java.lang.String prefix,
                                                java.lang.String name)
      • comment

        public void comment​(@Nonnull
                            java.lang.String comment)
                     throws WritingFailed
        Write a comment to the output. Writing need not be started at this point; comments can be written prior to any actual serialized RDF
        Specified by:
        comment in interface RDFWriter
        Parameters:
        comment - the comment to write
        Throws:
        WritingFailed
      • flushPendingStatements

        protected void flushPendingStatements()
                                       throws java.io.IOException,
                                              WritingFailed
        Throws:
        java.io.IOException
        WritingFailed
      • writeStartOfStartTag

        protected void writeStartOfStartTag​(@Nonnull
                                            java.lang.String theNamespace,
                                            @Nonnull
                                            java.lang.String theLocalName)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • writeAttribute

        protected void writeAttribute​(java.lang.String attName,
                                      java.lang.String value)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • writeAttribute

        protected void writeAttribute​(java.lang.String namespace,
                                      java.lang.String attName,
                                      java.lang.String value)
                               throws java.io.IOException,
                                      WritingFailed
        Throws:
        java.io.IOException
        WritingFailed
      • writeEndOfStartTag

        protected void writeEndOfStartTag()
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • writeEndOfEmptyTag

        protected void writeEndOfEmptyTag()
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • writeEndTag

        protected void writeEndTag​(java.lang.String namespace,
                                   java.lang.String localName)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • writeCharacterData

        protected void writeCharacterData​(java.lang.String chars)
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • writeIndent

        protected void writeIndent()
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • writeNewLine

        protected void writeNewLine()
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • getValidNodeId

        protected java.lang.String getValidNodeId​(@Nonnull
                                                  BNode theBNode)
                                           throws java.io.IOException
        Create a syntactically valid node id from the supplied blank node id. This is necessary because RDF/XML syntax enforces the blank node id is a valid NCName.
        Parameters:
        theBNode - a blank node identifier
        Returns:
        the blank node identifier converted to a form that is a valid NCName.
        Throws:
        java.io.IOException
        See Also:
        section 7.2.34 of the RDF/XML Syntax specification
      • format

        @Nonnull
        public RDFFormat format()
        The format this writer will serialize output in.
        Specified by:
        format in interface RDFWriter
        Returns:
        the format