Class BaseXMLWriter

  • All Implemented Interfaces:
    RDFWriterI, RDFXMLWriterI
    Direct Known Subclasses:
    Abbreviated, Basic

    public abstract class BaseXMLWriter
    extends java.lang.Object
    implements RDFXMLWriterI
    This is not part of the public API. Base class for XML serializers. All methods with side-effects should be synchronized in this class and its subclasses. (i. e. XMLWriters assume that the world is not changing around them while they are writing). Functionality:
    • setProperty etc
    • namespace prefixes
    • xmlbase
    • relative URIs
    • encoding issues
    • anonymous node presentational
    • errorHandler
    • Constructor Detail

      • BaseXMLWriter

        public BaseXMLWriter()
    • Method Detail

      • setNsPrefix

        public final void setNsPrefix​(java.lang.String prefix,
                                      java.lang.String ns)
      • getPrefixFor

        public final java.lang.String getPrefixFor​(java.lang.String uri)
      • write

        public final void write​(Model model,
                                java.io.OutputStream out,
                                java.lang.String base)
        Write out an XML serialization of a model.
        Specified by:
        write in interface RDFWriterI
        Parameters:
        model - the model to be serialized
        out - the OutputStream to receive the serialization
        base - The URL at which the file will be placed.
      • write

        public void write​(Model model,
                          java.io.Writer out,
                          java.lang.String base)
        Serialize Model model to Writer out.
        Specified by:
        write in interface RDFWriterI
        Parameters:
        model - The model to be written.
        out - The Writer to which the serialization should be sent.
        base - the base URI for relative URI calculations. null means use only absolute URI's.
      • isPredefinedEntityName

        public boolean isPredefinedEntityName​(java.lang.String name)
      • setErrorHandler

        public RDFErrorHandler setErrorHandler​(RDFErrorHandler errHandler)
        Set an error handler.
        Specified by:
        setErrorHandler in interface RDFWriterI
        Parameters:
        errHandler - The new error handler to be used, or null for the default handler.
        Returns:
        the old error handler
      • setProperty

        public final java.lang.Object setProperty​(java.lang.String propName,
                                                  java.lang.Object propValue)
        Set the writer property propName to the value obtained from propValue. Return an Object representation of the original value.
        Specified by:
        setProperty in interface RDFWriterI
        Specified by:
        setProperty in interface RDFXMLWriterI
        Parameters:
        propName - One of "xmlBase", "longId", "allowBadURIs", "relativeURIs","showXMLDeclaration", "tab", "attributeQuoteChar", "blockRules", "prettyTypes", "showDoctypeDeclaration", "width"
        propValue - A String, Boolean, Integer, Resource[] as appropriate.
        Returns:
        the old value for this property, or null if no value was set.
        See Also:
        RDFWriterI.setProperty(java.lang.String, java.lang.Object)
      • str2flags

        public static int str2flags​(java.lang.String pv)