/** * Return the string representation of the object * * * @return the string representation of the object */ public String toString() { return str(); }
/** * Return the string representation of the object * * * @return the string representation of the object */ public String toString() { return str(); }
/** * Cast result object to a string. * * * NEEDSDOC @param fsb * @return The string this wraps or the empty string if null */ public void appendToFsb(org.apache.xml.utils.FastStringBuffer fsb) { fsb.append(str()); }
/** * Cast result object to a string. * * * NEEDSDOC @param fsb * @return The string this wraps or the empty string if null */ public void appendToFsb(org.apache.xml.utils.FastStringBuffer fsb) { fsb.append(str()); }
/** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { String s1 = m_arg0.execute(xctxt).str(); String s2 = m_arg1.execute(xctxt).str(); // Add this check for JDK consistency for empty strings. if (s1.length() == 0 && s2.length() == 0) return XBoolean.S_TRUE; int index = s1.indexOf(s2); return (index > -1) ? XBoolean.S_TRUE : XBoolean.S_FALSE; } }
/** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { String s1 = m_arg0.execute(xctxt).str(); String s2 = m_arg1.execute(xctxt).str(); // Add this check for JDK consistency for empty strings. if (s1.length() == 0 && s2.length() == 0) return XBoolean.S_TRUE; int index = s1.indexOf(s2); return (index > -1) ? XBoolean.S_TRUE : XBoolean.S_FALSE; } }
/** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { String s1 = m_arg0.execute(xctxt).str(); String s2 = m_arg1.execute(xctxt).str(); int index = s1.indexOf(s2); return (-1 == index) ? XString.EMPTYSTRING : new XString(s1.substring(0, index)); } }
/** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { String s1 = m_arg0.execute(xctxt).str(); String s2 = m_arg1.execute(xctxt).str(); int index = s1.indexOf(s2); return (-1 == index) ? XString.EMPTYSTRING : new XString(s1.substring(0, index)); } }
/** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { StringBuffer sb = new StringBuffer(); // Compiler says we must have at least two arguments. sb.append(m_arg0.execute(xctxt).str()); sb.append(m_arg1.execute(xctxt).str()); if (null != m_arg2) sb.append(m_arg2.execute(xctxt).str()); if (null != m_args) { for (int i = 0; i < m_args.length; i++) { sb.append(m_args[i].execute(xctxt).str()); } } return new XString(sb.toString()); }
/** * Cast result object to a string. * * @return The string this wraps or the empty string if null */ public XMLString xstr() { return XMLStringFactoryImpl.getFactory().newstr(str()); }
/** * Cast result object to a string. * * @return The string this wraps or the empty string if null */ public XMLString xstr() { return XMLStringFactoryImpl.getFactory().newstr(str()); }
private Object getResultAsType( XObject resultObject, QName returnType ) throws javax.xml.transform.TransformerException { // XPathConstants.STRING if ( returnType.equals( XPathConstants.STRING ) ) { return resultObject.str(); } // XPathConstants.NUMBER if ( returnType.equals( XPathConstants.NUMBER ) ) { return new Double ( resultObject.num()); } // XPathConstants.BOOLEAN if ( returnType.equals( XPathConstants.BOOLEAN ) ) { return new Boolean( resultObject.bool()); } // XPathConstants.NODESET ---ORdered, UNOrdered??? if ( returnType.equals( XPathConstants.NODESET ) ) { return resultObject.nodelist(); } // XPathConstants.NODE if ( returnType.equals( XPathConstants.NODE ) ) { NodeIterator ni = resultObject.nodeset(); //Return the first node, or null return ni.nextNode(); } String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_UNSUPPORTED_RETURN_TYPE, new Object[] { returnType.toString()}); throw new IllegalArgumentException( fmsg ); }
/** * Cast result object to a result tree fragment. * * @param support XPath context to use for the conversion * * @return the objec as a result tree fragment. */ public int rtf(XPathContext support) { int result = rtf(); if (DTM.NULL == result) { DTM frag = support.createDocumentFragment(); // %OPT% frag.appendTextChild(str()); result = frag.getDocument(); } return result; }
/** * For support of literal objects in xpaths. * * @param xctxt The XPath execution context. * * @return the result of executing the select expression * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { XObject m_selected; m_selected = ((Expression)m_obj).execute(xctxt); m_selected.allowDetachToRelease(m_allowRelease); if (m_selected.getType() == CLASS_STRING) return m_selected; else return new XString(m_selected.str()); }
/** * Cast result object to a result tree fragment. * * @param support XPath context to use for the conversion * * @return the objec as a result tree fragment. */ public int rtf(XPathContext support) { int result = rtf(); if (DTM.NULL == result) { DTM frag = support.createDocumentFragment(); // %OPT% frag.appendTextChild(str()); result = frag.getDocument(); } return result; }
/** * For support of literal objects in xpaths. * * @param xctxt The XPath execution context. * * @return the result of executing the select expression * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { XObject m_selected; m_selected = ((Expression)m_obj).execute(xctxt); m_selected.allowDetachToRelease(m_allowRelease); if (m_selected.getType() == CLASS_STRING) return m_selected; else return new XString(m_selected.str()); }
/** * The value of this string result. * @exception XPathException * TYPE_ERR: raised if <code>resultType</code> is not * <code>STRING_TYPE</code>. * * @see org.w3c.dom.xpath.XPathResult#getStringValue() */ public String getStringValue() throws XPathException { if (getResultType() != STRING_TYPE) { String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_CANT_CONVERT_TO_STRING, new Object[] {m_xpath.getPatternString(), m_resultObj.getTypeString()}); throw new XPathException(XPathException.TYPE_ERR,fmsg); // "The XPathResult of XPath expression {0} has an XPathResultType of {1} which cannot be converted to a string." } else { try { return m_resultObj.str(); } catch (Exception e) { // Type check above should prevent this exception from occurring. throw new XPathException(XPathException.TYPE_ERR,e.getMessage()); } } }
/** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { String name = m_arg0.execute(xctxt).str(); int context = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(context); int doc = dtm.getDocument(); String uri = dtm.getUnparsedEntityURI(name); return new XString(uri); } }
/** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { String name = m_arg0.execute(xctxt).str(); int context = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(context); int doc = dtm.getDocument(); String uri = dtm.getUnparsedEntityURI(name); return new XString(uri); } }
/** * Cast result object to a result tree fragment. * * @param support XPath context to use for the conversion * * @return the objec as a result tree fragment. */ public DocumentFragment rtree(XPathContext support) { DocumentFragment docFrag = null; int result = rtf(); if (DTM.NULL == result) { DTM frag = support.createDocumentFragment(); // %OPT% frag.appendTextChild(str()); docFrag = (DocumentFragment)frag.getNode(frag.getDocument()); } else { DTM frag = support.getDTM(result); docFrag = (DocumentFragment)frag.getNode(frag.getDocument()); } return docFrag; }