Class XMLWriterImpl

    • Field Detail

      • filename

        protected String filename
        Name of the XML-file to write into.
      • outputStream

        protected OutputStream outputStream
        Outputstream to write into.
    • Constructor Detail

      • XMLWriterImpl

        public XMLWriterImpl()
    • Method Detail

      • setFilename

        public void setFilename​(String filename)
        Each writer must be able to write a file to the local filesytem. The filename should be an absolute path.
        Specified by:
        setFilename in interface Writer
        Parameters:
        filename - The filename into which the object should be stored.
      • setOutputStream

        public void setOutputStream​(OutputStream output)
        Each writer must be able to store the object into an OutputStream.
        Specified by:
        setOutputStream in interface Writer
        Parameters:
        output - The OutputStream into that the object should be stored.
      • createXMLWriter

        protected XMLSchemaBasedWriter createXMLWriter()
                                                throws IOException
        Based on the setting of filename and outputstream an outputmode is chosen. If a filename exists, the output goes to the file. If not the outputstream is used.
        Returns:
        The XMLWriter representing the file or outputstream.
        Throws:
        IOException
      • insertNamespace

        public abstract void insertNamespace​(XMLSchemaBasedWriter writer)
        Adds the namespace-imports of this handler to the given xmlWriter.
        Parameters:
        writer - a XMLSchemaBasedWriter object
      • store

        public abstract void store​(Object value,
                                   XMLSchemaBasedWriter writer)
                            throws CakeIOException
        To embed xml writers into another one it must be possible to specify the parent XMLSchemaBasedWriter as well as a prefix that should be probably used. If a parent writer is specified, no header will be written.

        If the writer does not support XML writing, the writer should throw an UnsupportedOperationException.

         public void store(Object value, String prefix, XMLWriter writer) throws CakeIOException {
                throw new UnsupportedOperationException();
         }
         
        Parameters:
        writer - A parent writer that is used.
        value - a Object object
        Throws:
        CakeIOException - if any.
      • correctPrefix

        protected String correctPrefix​(String currentPrefix,
                                       String alternatePrefix)
        Analyses the given namespace-prefix and corrects it if neccessary.
        Parameters:
        currentPrefix - The namespace-prefix, which should be checked.
        alternatePrefix - a String object
        Returns:
        The useable namespace-prefix.