Package org.exist.storage.serializers

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


                System.out.println(serializer.serialize((NodeValue) seq.itemAt(0)));
            }
            seq = xquery.execute("//product[description &= 'Updated']", null, AccessContext.TEST);
            assertEquals(seq.getItemCount(), ITEMS_TO_APPEND);

            System.out.println(serializer.serialize((NodeValue) seq.itemAt(0)));
           
            query =
              "declare option exist:output-size-limit '-1';\n" +
              "for $prod at $count in //product return\n" +
                "  update value $prod/stock/text()\n" +
View Full Code Here


            seq = xquery.execute("//product[stock > 400]", null, AccessContext.TEST);
            assertEquals(seq.getItemCount(), ITEMS_TO_APPEND);
            seq = xquery.execute("//product[stock &= '401']", null, AccessContext.TEST);
            assertEquals(seq.getItemCount(), 1);

            System.out.println(serializer.serialize((NodeValue) seq.itemAt(0)));
           
            query =
              "declare option exist:output-size-limit '-1';\n" +
              "for $prod in //product return\n" +
                "  update value $prod/@num\n" +
View Full Code Here

            assertEquals(seq.getItemCount(), 1);
           
            seq = xquery.execute("//product[@num = 3]", null, AccessContext.TEST);
            assertEquals(seq.getItemCount(), 1);
           
            System.out.println(serializer.serialize((NodeValue) seq.itemAt(0)));
           
            query =
              "declare option exist:output-size-limit '-1';\n" +
              "for $prod in //product return\n" +
                "  update value $prod/stock\n" +
View Full Code Here

            Sequence seq = xquery.execute("/products", null, AccessContext.TEST);
            assertEquals(seq.getItemCount(), 1);

            Serializer serializer = broker.getSerializer();
            System.out.println(serializer.serialize((NodeValue) seq.itemAt(0)));

            seq = xquery.execute("//product", null, AccessContext.TEST);
            assertEquals(ITEMS_TO_APPEND, seq.getItemCount());

            System.out.println("testAppendCDATA: PASS");
View Full Code Here

                item = results.itemAt(i);
                if (Type.subTypeOf(item.getType(), Type.NODE)) {
                    final NodeValue value = (NodeValue) item;
                    JSONValue json;
                    if ("json".equals(outputProperties.getProperty("method", "xml"))) {
                        json = new JSONValue(serializer.serialize(value), false);
                        json.setSerializationType(JSONNode.SerializationType.AS_LITERAL);
                    } else {
                        json = new JSONValue(serializer.serialize(value));
                        json.setSerializationType(JSONNode.SerializationType.AS_ARRAY);
                    }
View Full Code Here

                    JSONValue json;
                    if ("json".equals(outputProperties.getProperty("method", "xml"))) {
                        json = new JSONValue(serializer.serialize(value), false);
                        json.setSerializationType(JSONNode.SerializationType.AS_LITERAL);
                    } else {
                        json = new JSONValue(serializer.serialize(value));
                        json.setSerializationType(JSONNode.SerializationType.AS_ARRAY);
                    }
                    data.addObject(json);
                } else {
                    final JSONValue json = new JSONValue(item.getStringValue());
View Full Code Here

        broker = pool.get(user);
        final Serializer serializer = broker.getSerializer();
        serializer.setUser(user);
        serializer.setProperties(getProperties());
        if (root != null) {
          content = serializer.serialize((NodeValue) root);
                   
                } else if (proxy != null) {
                    content = serializer.serialize(proxy);
                   
                } else {
View Full Code Here

        serializer.setProperties(getProperties());
        if (root != null) {
          content = serializer.serialize((NodeValue) root);
                   
                } else if (proxy != null) {
                    content = serializer.serialize(proxy);
                   
                } else {
            document = openDocument(broker, Lock.READ_LOCK);
          if (!document.getPermissions().validate(user,
              Permission.READ))
View Full Code Here

            document = openDocument(broker, Lock.READ_LOCK);
          if (!document.getPermissions().validate(user,
              Permission.READ))
            {throw new XMLDBException(ErrorCodes.PERMISSION_DENIED,
                "permission denied to read resource");}
          content = serializer.serialize(document);
                }
        return content;
      } catch (final SAXException saxe) {
        saxe.printStackTrace();
        throw new XMLDBException(ErrorCodes.VENDOR_ERROR, saxe
View Full Code Here

            try {
              response.setContentType(resource.getMetadata()
                  .getMimeType() + "; charset=" + charset);
              final Writer w = new OutputStreamWriter(
                  response.getOutputStream(), charset);
              serializer.serialize(resource, w);
              w.flush();
              w.close();
            } catch (final IOException ex) {
              LOG.fatal(
                  "Cannot read resource " + request.getPath(),
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.