Package org.exist.xquery.value

Examples of org.exist.xquery.value.StringValue


  public Sequence eval(Sequence[] args, Sequence contextSequence)
        throws XPathException {

    try {
      if(isCalledAs("encode")) {
        return new StringValue(URIUtils.urlEncodePartsUtf8(args[0].getStringValue()));
      } else if(isCalledAs("encode-uri")) {
        return new AnyURIValue(URIUtils.encodeXmldbUriFor(args[0].getStringValue()));
      } else {
        return new StringValue(URIUtils.urlDecodeUtf8(args[0].getStringValue()));
      }
    } catch(final URISyntaxException e) {
            logger.error(e.getMessage(), e);
      throw new XPathException(this, "URI Syntax Exception: " + e.getMessage(), e);
    } finally {
View Full Code Here


    if (value.getObject() instanceof RequestWrapper)
    {
      final String queryString = ((RequestWrapper) value.getObject()).getQueryString();
      if(queryString != null)
      {
        return new StringValue(queryString);
      }
      else
      {
        return Sequence.EMPTY_SEQUENCE;
      }
View Full Code Here

                logger.warn(ioe.getMessage(), ioe);
            }
        }
        // END TEMP
       
        result.add(new StringValue(builder.toString()));
       
    }
View Full Code Here

    if (var.getValue().getItemType() != Type.JAVA_OBJECT)
      {throw new XPathException(this, "Variable $request is not bound to an Java object.");}

    final JavaObjectValue value = (JavaObjectValue) var.getValue().itemAt(0);
    if (value.getObject() instanceof RequestWrapper) {
      return new StringValue(((RequestWrapper) value.getObject()).getServerName());
    } else
      {throw new XPathException(this, "Variable $request is not bound to a Request object.");}
  }
View Full Code Here

        final Sequence result;
       
        if(isCalledAs(qnListUsers.getLocalName())) {
            result = new ValueSequence();
            if(currentUser.getName().equals(SecurityManager.GUEST_USER)) {
                result.add(new StringValue(SecurityManager.GUEST_USER));
            } else {
                addUserNamesToSequence(securityManager.findAllUserNames(), result);
            }
        } else {
       
View Full Code Here

    private void addUserNamesToSequence(final List<String> userNames, final Sequence sequence) throws XPathException {
        //order a-z
        Collections.sort(userNames);

        for(final String userName : userNames) {
            sequence.add(new StringValue(userName));
        }
    }
View Full Code Here

      {throw new XPathException(this, "Variable $request is not bound to an Java object.");}

    final JavaObjectValue value = (JavaObjectValue) var.getValue().itemAt(0);
   
    if (value.getObject() instanceof RequestWrapper) {
      return new StringValue(((RequestWrapper) value.getObject()).getRequestURL().toString());
    } else
      {throw new XPathException(this, "Variable $request is not bound to a Request object.");}
  }
View Full Code Here

          serialize(args[0].iterate(), outputProperties, os);
         
          try
          {
            final String encoding = outputProperties.getProperty(OutputKeys.ENCODING, "UTF-8");
            return new StringValue(new String(((ByteArrayOutputStream)os).toByteArray(), encoding));
          }
          catch(final UnsupportedEncodingException e)
          {
            throw new XPathException(this, "A problem occurred while serializing the node set: " + e.getMessage(), e);
          }
View Full Code Here

      return Sequence.EMPTY_SEQUENCE;

        } else {
      try {
                //TODO : use dedicated function in XmldbURI
        return new StringValue(collection.getName() + "/" + resource.getId());
      } catch (final XMLDBException e) {
                logger.error(e.getMessage());
        throw new XPathException(this, "XMLDB reported an exception while retrieving the " +
            "stored document", e);
      }
View Full Code Here

        if (type == null)
          {return Sequence.EMPTY_SEQUENCE;} //UNDERSTAND: error?
       
        final Object value = context.getSubject().getMetadataValue(type);
        if (value != null) {
            final StringValue stringValue = new StringValue((String) value);
            return stringValue;
        } else {
            return Sequence.EMPTY_SEQUENCE;
        }
  }
View Full Code Here

TOP

Related Classes of org.exist.xquery.value.StringValue

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.