Package org.exist.storage.serializers

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


      }

      final String charset = getContext().getDefaultCharset();
      response.setContentType("application/atom+xml; charset=" + charset);
      final Serializer serializer = broker.getSerializer();
      serializer.reset();

      try {
        final Writer w = new OutputStreamWriter(response.getOutputStream(), charset);
        final SAXSerializer sax = (SAXSerializer) SerializerPool.getInstance().borrowObject(SAXSerializer.class);
        final Properties outputProperties = new Properties();
View Full Code Here


                }
               
            } else {
                if(resource.getResourceType() == DocumentImpl.XML_FILE) {
                    final Serializer serializer = broker.getSerializer();
                    serializer.reset();
                   
                    // Preserve doctype
                    serializer.setProperty(EXistOutputKeys.OUTPUT_DOCTYPE, "yes");
                    final Writer w = new OutputStreamWriter(os,"UTF-8");
                    serializer.serialize(resource,w);
View Full Code Here

          throw new BadRequestException("No topic was found.");
        }
        response.setStatusCode(200);
        response.setContentType(Atom.MIME_TYPE + "; charset=" + charset);
        final Serializer serializer = broker.getSerializer();
        serializer.reset();
        try {
          final Writer w = new OutputStreamWriter(
              response.getOutputStream(), charset);
          final SAXSerializer sax = (SAXSerializer) SerializerPool
              .getInstance().borrowObject(SAXSerializer.class);
View Full Code Here

    /* (non-Javadoc)
     * @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);}
       
        if (handler instanceof LexicalHandler) {
View Full Code Here

     
      Sequence resultSequence = service.execute(compiled, null);
 
          SAXSerializer sax = null;
          Serializer serializer = broker.getSerializer();
      serializer.reset();
          try {
              sax = (SAXSerializer) SerializerPool.getInstance().borrowObject(SAXSerializer.class);
              Properties outputProps = new Properties();
              StringWriter writer = new StringWriter();
              sax.setOutput(writer, outputProps);
View Full Code Here

      final String charset = getContext().getDefaultCharset();
      response.setStatusCode(200);
      response.setContentType(config.contentType + "; charset=" + charset);
      final Serializer serializer = broker.getSerializer();
      serializer.reset();
      try {
        final Writer w = new OutputStreamWriter(response.getOutputStream(), charset);
        final SAXSerializer sax = (SAXSerializer) SerializerPool.getInstance().borrowObject(SAXSerializer.class);
       
        final Properties outputProperties = new Properties();
View Full Code Here

    DBBroker broker = null;
    try {
      broker = brokerPool.get(user);
      // configure the serializer
      final Serializer serializer = broker.getSerializer();
      serializer.reset();
      collection.properties.setProperty(Serializer.GENERATE_DOC_EVENTS, "false");
      serializer.setProperties(outputProperties);
      serializer.setUser(user);
      serializer.setSAXHandlers(handler, handler);
View Full Code Here

           
            DocumentImpl doc = test.getDocument(broker, XmldbURI.createInternal("document.xml"));
            assertNotNull(doc);
           
            Serializer serializer = broker.getSerializer();
            serializer.reset();
            String xml = serializer.serialize(doc);
            System.out.println(xml);
        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
View Full Code Here

       
        //get the test document
        DocumentImpl doc = root.getDocumentWithLock(broker, XmldbURI.create(documentName), Lock.READ_LOCK);
       
        Serializer serializer = broker.getSerializer();
        serializer.reset();
        SAXSerializer sax = null;
        StringWriter writer = new StringWriter();
        sax = (SAXSerializer) SerializerPool.getInstance().borrowObject(SAXSerializer.class);
        Properties outputProperties = new Properties();
        outputProperties.setProperty(OutputKeys.INDENT, "no");
View Full Code Here

        Database db = context.getDatabase();
        try {
          broker = db.getBroker();
          Serializer serializer = broker.getSerializer();
          serializer.reset();
 
          try {
            StringBuilder property = new StringBuilder();
              if (value.hasOne()) {
                  String strVal = getPropertyValue(value.itemAt(0), serializer);
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.