Package org.exist.storage.serializers

Examples of org.exist.storage.serializers.Serializer.reset()


            if (expandRefs) {
                DBBroker broker = null;
                try {
                    broker = getDatabase().get(null);
                    final Serializer serializer = broker.getSerializer();
                    serializer.reset();
                    serializer.setProperty(Serializer.GENERATE_DOC_EVENTS, "false");
                    serializer.setReceiver(receiver);
                    serializer.toReceiver(document.references[document.alpha[nr]], false, false);
                } catch (final EXistException e) {
                    throw new SAXException(e);
View Full Code Here


     * @see org.exist.xquery.value.Item#toSAX(org.exist.storage.DBBroker, org.xml.sax.ContentHandler)
     */
    public void toSAX( DBBroker broker, ContentHandler handler, Properties properties )
        throws SAXException {
        final Serializer serializer = broker.getSerializer();
        serializer.reset();
        serializer.setProperty( Serializer.GENERATE_DOC_EVENTS, "false" );

        if( properties != null ) {
            serializer.setProperties( properties );
        }
View Full Code Here

            if (requestAttr != null && (XmldbURI.API_LOCAL.equals(collectionURI.getApiName())) ) {
                request.setAttribute(requestAttr, resultSequence);
               
            } else {
              final Serializer serializer = broker.getSerializer();
              serializer.reset();
           
              final SerializerPool serializerPool = SerializerPool.getInstance();

              final SAXSerializer sax = (SAXSerializer) serializerPool.borrowObject(SAXSerializer.class);
              try {
View Full Code Here

        }

        final StringBuilder out = new StringBuilder();

        final Serializer serializer = context.getBroker().getSerializer();
        serializer.reset();
        try {
            serializer.setProperties(outputProperties);
            final Sequence normalized = normalize(args[0]);
            for (final SequenceIterator i = normalized.iterate(); i.hasNext(); ) {
                final Item next = i.nextItem();
View Full Code Here

   
    while(i.hasNext()) {
      final Item next = i.nextItem();
      if( Type.subTypeOf( next.getType(), Type.NODE ) ) {
        final Serializer serializer = context.getBroker().getSerializer();
        serializer.reset();
        try {
          buf.append( serializer.serialize( (NodeValue)next ) );
        }
        catch( final SAXException e ) {
          throw( new XPathException(this, "An exception occurred while serializing node to log: " + e.getMessage(), e ) );
View Full Code Here

            try {
                final TemplatesHandler handler = factory.newTemplatesHandler();
                handler.startDocument();

                final Serializer serializer = broker.getSerializer();
                serializer.reset();
                serializer.setSAXHandlers(handler, null);
                serializer.toSAX(stylesheet);

                handler.endDocument();      
                return handler.getTemplates();
View Full Code Here

            final DocumentImpl document = broker.getResource(name, Permission.READ);
            if (document == null)
                {throw new RemoteException("resource " + name + " not found");}

            final Serializer serializer = broker.getSerializer();
            serializer.reset();
            serializer.setProperties(outputProperties);
            return serializer.serialize(document);
           
            //      if (xml != null)
            //        try {
View Full Code Here

            if (start + howmany > seq.getItemCount() || howmany == 0)
                {howmany = seq.getItemCount() - start + 1;}
           
            final String xml[] = new String[howmany];
            final Serializer serializer = broker.getSerializer();
            serializer.reset();
            serializer.setProperty(OutputKeys.INDENT, indent ? "yes" : "no");
            serializer.setProperty(EXistOutputKeys.EXPAND_XINCLUDES, xinclude ? "yes" : "no");
            serializer.setProperty(EXistOutputKeys.HIGHLIGHT_MATCHES, highlight);
           
            Item item;
View Full Code Here

                    {throw new RemoteException(
                            "index " + start + "out of bounds (" + hitsByDoc.getLength() + ")");}
                if (start + howmany >= hitsByDoc.getLength())
                    {howmany = hitsByDoc.getLength() - start;}
                final Serializer serializer = broker.getSerializer();
                serializer.reset();
                serializer.setProperty(OutputKeys.INDENT, indent ? "yes" : "no");
                serializer.setProperty(EXistOutputKeys.EXPAND_XINCLUDES, xinclude ? "yes" : "no");
                serializer.setProperty(EXistOutputKeys.HIGHLIGHT_MATCHES, highlight);
               
                xml = new String[howmany];
View Full Code Here

    private String queryResult2String(DBBroker broker, Sequence seq, int index) throws SAXException, XPathException {
        Properties props = new Properties();
        props.setProperty(OutputKeys.INDENT, "no");
        props.setProperty(EXistOutputKeys.HIGHLIGHT_MATCHES, "elements");
        Serializer serializer = broker.getSerializer();
        serializer.reset();
        serializer.setProperties(props);
        return serializer.serialize((NodeValue) seq.itemAt(index));
    }
}
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.