Class RDFXMLWriter

    • Field Detail

      • writer

        protected final java.io.Writer writer
      • defaultNamespace

        protected java.lang.String defaultNamespace
      • headerWritten

        protected boolean headerWritten
      • lastWrittenSubject

        protected Resource lastWrittenSubject
      • quote

        protected char quote
      • entityQuote

        protected boolean entityQuote
    • Constructor Detail

      • RDFXMLWriter

        public RDFXMLWriter​(java.io.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​(java.io.OutputStream out,
                            ParsedIRI baseIRI)
        Creates a new RDFXMLWriter that will write to the supplied OutputStream.
        Parameters:
        out - The OutputStream to write the RDF/XML document to.
        baseIRI - base URI
      • RDFXMLWriter

        public RDFXMLWriter​(java.io.Writer writer)
        Creates a new RDFXMLWriter that will write to the supplied Writer.
        Parameters:
        writer - The Writer to write the RDF/XML document to.
      • RDFXMLWriter

        public RDFXMLWriter​(java.io.Writer writer,
                            ParsedIRI baseIRI)
        Creates a new RDFXMLWriter that will write to the supplied Writer.
        Parameters:
        writer - The Writer to write the RDF/XML document to.
        baseIRI - base URI
    • Method Detail

      • getWriter

        public java.io.Writer getWriter()
        Description copied from interface: CharSink
        get the Writer used by this CharSink.
        Specified by:
        getWriter in interface CharSink
        Returns:
        an Writer
      • writeHeader

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

        public void endRDF()
                    throws RDFHandlerException
        Description copied from interface: RDFHandler
        Signals the end of the RDF data. This method is called when all data has been reported.
        Specified by:
        endRDF in interface RDFHandler
        Throws:
        RDFHandlerException - If the RDF handler has encountered an unrecoverable error.
      • handleNamespace

        public void handleNamespace​(java.lang.String prefix,
                                    java.lang.String name)
        Description copied from interface: RDFHandler
        Handles a namespace declaration/definition. A namespace declaration associates a (short) prefix string with the namespace's URI. The prefix for default namespaces, which do not have an associated prefix, are represented as empty strings.
        Specified by:
        handleNamespace in interface RDFHandler
        Overrides:
        handleNamespace in class AbstractRDFWriter
        Parameters:
        prefix - The prefix for the namespace, or an empty string in case of a default namespace.
        name - The URI that the prefix maps to.
      • setNamespace

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

        protected void writeStartOfStartTag​(java.lang.String namespace,
                                            java.lang.String localName)
                                     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,
                                      RDFHandlerException
        Throws:
        java.io.IOException
        RDFHandlerException
      • writeQuotedAttribute

        protected void writeQuotedAttribute​(java.lang.String attName,
                                            java.lang.String value)
                                     throws java.io.IOException
        Write quoted attribute
        Parameters:
        attName - attribute name
        value - string value
        Throws:
        java.io.IOException
      • writeEndOfStartTag

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

        protected void writeEndOfEmptyTag()
                                   throws java.io.IOException
        Write > or />
        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
        Replace special characters in text with entities.
        Parameters:
        chars - text
        Throws:
        java.io.IOException
      • writeIndent

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

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

        protected java.lang.String getValidNodeId​(BNode bNode)
                                           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:
        bNode - 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