Package javolution.xml.stream

Examples of javolution.xml.stream.XMLStreamWriter


        try {
            // Formats the request message (we cannot write directly to
            // the output stream because the http request requires the length.
            _out.setOutput(_buffer);
            _writer.setOutput(_out);
            final XMLStreamWriter xmlOut = _writer.getStreamWriter();
            xmlOut.setPrefix(csq(ENVELOPE_PREFIX), csq(ENVELOPE_URI));
            xmlOut.writeStartElement(csq(ENVELOPE_URI), csq("Envelope"));
            xmlOut.writeNamespace(csq(ENVELOPE_PREFIX), csq(ENVELOPE_URI));
            xmlOut.writeStartElement(csq(ENVELOPE_URI), csq("Header"));
            xmlOut.writeEndElement();
            xmlOut.writeStartElement(csq(ENVELOPE_URI), csq("Body"));
            writeRequest(_writer);
            _writer.close();

            // Sends the request.
            if (_url == null)
View Full Code Here


    public void save() throws OKMException {
        try {
            XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
            FileOutputStream stream = new FileOutputStream(documentFilename);
            XMLStreamWriter writer;
            writer = outputFactory.createXMLStreamWriter(stream,"UTF-8");
            writer.writeStartDocument("utf-8", "1.0");      // Header
            writer.writeStartElement("openkm");             // openkm node

            for (Iterator<OKMDocumentBean> it = docList.iterator(); it.hasNext();) {
                OKMDocumentBean doc = it.next();
                writer.writeStartElement("document");       // document node

                writer.writeStartElement("uuid");           // uuid
                writer.writeCharacters(doc.getUUID());
                writer.writeEndElement();

                writer.writeStartElement("path");           // path
                writer.writeCharacters(doc.getPath());
                writer.writeEndElement();

                writer.writeStartElement("localfilename")// localfilename
                writer.writeCharacters(doc.getLocalFilename());
                writer.writeEndElement();

                writer.writeStartElement("name");           // name
                writer.writeCharacters(doc.getName());
                writer.writeEndElement();

                writer.writeEndElement();                   // close document
            }

            writer.writeEndElement();                       // close openkm
            writer.flush();
            writer.close();

        } catch (XMLStreamException ex) {
            throw new OKMException(ex);
        } catch (IOException ex) {
            throw new OKMException(ex);
View Full Code Here

    public void save(ConfigBean configBean) throws OKMException {
        try {
            XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
            FileOutputStream stream = new FileOutputStream(configFilename);
            XMLStreamWriter writer;
            writer = outputFactory.createXMLStreamWriter(stream,"UTF-8");

            writer.writeStartDocument("utf-8", "1.0");      // Header
            writer.writeStartElement("openkm");             // openkm node

            writer.writeStartElement("host");               // host
            writer.writeCharacters(configBean.getHost());
            writer.writeEndElement();

            writer.writeStartElement("user");               // user
            writer.writeCharacters(configBean.getUser());
            writer.writeEndElement();

            if (configBean.getPassword().length()>0) {
                configBean.setPassword(encryption.encrypt(configBean.getPassword()));
            }
            writer.writeStartElement("password");           // password
            writer.writeCharacters(configBean.getPassword());
            writer.writeEndElement();

            writer.writeEndElement();                       // close openkm
            writer.flush();
            writer.close();

        } catch (XMLStreamException ex) {
            throw new OKMException(ex);
        } catch (IOException ex) {
            throw new OKMException(ex);
View Full Code Here

        try {
            // Formats the request message (we cannot write directly to
            // the output stream because the http request requires the length.
            _out.setOutput(_buffer);
            _writer.setOutput(_out);
            final XMLStreamWriter xmlOut = _writer.getStreamWriter();
            xmlOut.setPrefix(csq(ENVELOPE_PREFIX), csq(ENVELOPE_URI));
            xmlOut.writeStartElement(csq(ENVELOPE_URI), csq("Envelope"));
            xmlOut.writeNamespace(csq(ENVELOPE_PREFIX), csq(ENVELOPE_URI));
            xmlOut.writeStartElement(csq(ENVELOPE_URI), csq("Header"));
            xmlOut.writeEndElement();
            xmlOut.writeStartElement(csq(ENVELOPE_URI), csq("Body"));
            writeRequest(_writer);
            _writer.close();

            // Sends the request.
            if (_url == null)
View Full Code Here

TOP

Related Classes of javolution.xml.stream.XMLStreamWriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.