Examples of SaxWriter


Examples of xbird.util.xml.SAXWriter

        queryFile = XMARK_HOME + '/' + queryFile;
        final XQueryProcessor processor = new XQueryProcessor();
        XQueryModule mod = processor.parse(new FileInputStream(queryFile), new File(queryFile).toURI());
        Sequence result = processor.execute(mod);
        StringWriter res_sw = new StringWriter();
        final Serializer ser = new SAXSerializer(new SAXWriter(res_sw), res_sw);
        ser.emit(result);
        String swresult = sw.toString();
        long used = SystemUtils.getHeapUsedMemory();
        stdbuf.append(", used(before GC): " + StringUtils.displayBytesSize(used));
        if(RUN_ONLY) {
View Full Code Here

Examples of xbird.util.xml.SAXWriter

        request1.setBaseUri(new File(queryFile).toURI());
        Object result1 = engine.execute(request1);
        RemoteSequence remoteSequence = (RemoteSequence) result1;

        StringWriter res_sw = new StringWriter();
        Serializer ser = new SAXSerializer(new SAXWriter(res_sw), res_sw);
        ser.emit(remoteSequence);
        String swresult = sw.toString();
        long used = SystemUtils.getHeapUsedMemory();
        stdbuf.append(", used(before GC): " + StringUtils.displayBytesSize(used));
        System.gc();
View Full Code Here

Examples of xbird.util.xml.SAXWriter

        String query1 = "fn:collection('/" + COLLECTION_NAME + "/1.xml')//author[1]";
        XQueryProcessor proc = new XQueryProcessor();
        XQueryModule compiled1 = proc.parse(query1);
        StringWriter sw = new StringWriter();
        SAXWriter handler = new SAXWriter(sw);
        SAXSerializer ser = new SAXSerializer(handler);

        proc.execute(compiled1, ser);
        handler.flush();
        String result1 = sw.toString();

        System.err.println(result1);

        Author author1 = (Author) xstream.fromXML(result1);
View Full Code Here

Examples of xbird.util.xml.SAXWriter

    }

    @Override
    public String toString() {
        final StringWriter sw = new StringWriter();
        final SAXSerializer ser = new SAXSerializer(new SAXWriter(sw), sw);
        try {
            ser.emit(this);
        } catch (XQueryException e) {
            return "failed at " + e.getStackTrace()[1] + "!\n" + e.getMessage();
        }
View Full Code Here

Examples of xbird.util.xml.SAXWriter

    @Override
    public String toString() {
        final DocumentTableModel dtm = new DocumentTableModel(this);
        final FastMultiByteArrayOutputStream baos = new FastMultiByteArrayOutputStream();
        final SAXWriter writer = new SAXWriter(baos);
        final SAXSerializer ser = new SAXSerializer(writer);
        try {
            dtm.export(0, ser);
        } catch (XQueryException e) {
            PrintUtils.prettyPrintStackTrace(e, new PrintStream(baos));
View Full Code Here

Examples of xbird.util.xml.SAXWriter

    public String toString() {
        if(_citem == null) {
            return "ContextItem is not set.";
        }
        final StringWriter sw = new StringWriter();
        final SAXWriter writer = new SAXWriter(sw);
        writer.setXMLDeclaration(false);
        final SAXSerializer ser = new SAXSerializer(writer, sw);
        try {
            ser.emit(_citem);
        } catch (XQueryException e) {
            throw new XQRTException("eval failed!: " + e.getMessage());
View Full Code Here

Examples of xbird.util.xml.SAXWriter

    }

    @Override
    public String toString() {
        StringWriter sw = new StringWriter();
        SAXWriter saxwriter = new SAXWriter(sw);
        saxwriter.setXMLDeclaration(false);
        SAXSerializer ser = new SAXSerializer(saxwriter, sw);
        try {
            ser.emit(this);
        } catch (XQueryException e) {
            return "failed at " + e.getStackTrace()[1] + ".\n" + e.getMessage();
View Full Code Here

Examples of xbird.util.xml.SAXWriter

        final XQueryProcessor processor = new XQueryProcessor();
        // parse
        XQueryModule mod = processor.parse(queryStr, new File(queryFilePath).toURI());
        // execute              
        FastMultiByteArrayOutputStream out = new FastMultiByteArrayOutputStream();
        SAXWriter writer = new SAXWriter(out, "UTF-8");
        final Serializer ser = new SAXSerializer(writer);
        Sequence<? extends Item> result = processor.execute(mod);
        ser.emit(result);
        writer.flush();

        System.err.println(sw);
        return out.toString();
    }
View Full Code Here

Examples of xbird.util.xml.SAXWriter

        final XQueryProcessor processor = new XQueryProcessor();
        // parse
        XQueryModule mod = processor.parse(queryStr, new File(queryFilePath).toURI());
        // execute
        FastMultiByteArrayOutputStream out = new FastMultiByteArrayOutputStream();
        SAXWriter writer = new SAXWriter(out, "UTF-8");
        final Serializer ser = new SAXSerializer(writer);
        Sequence<? extends Item> result = processor.execute(mod);
        ser.emit(result);
        //processor.execute(mod, ser);
        writer.flush();

        System.err.println(sw);
        return out.toString();
    }
View Full Code Here

Examples of xbird.util.xml.SAXWriter

            XMLStreamException, UnsupportedEncodingException {
        XQueryProcessor proc = new XQueryProcessor();
        InputStream input = new ByteArrayInputStream(query.getBytes("UTF-8"));
        XQueryModule module = proc.parse(input);
        StringWriter writer = new StringWriter(8192);
        SAXWriter saxwr = new SAXWriter(writer);
        Serializer ser = new SAXSerializer(saxwr, writer);
        //ser.setInterveBlanks(false);
        proc.execute(module, ser);
        return writer.toString();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.