1 16 19 package org.apache.xpath.functions; 20 21 import org.apache.xalan.res.XSLMessages; 22 import org.apache.xpath.XPathContext; 23 import org.apache.xpath.objects.XObject; 24 import org.apache.xpath.objects.XString; 25 26 30 public class FuncConcat extends FunctionMultiArgs 31 { 32 33 41 public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException 42 { 43 44 StringBuffer sb = new StringBuffer (); 45 46 sb.append(m_arg0.execute(xctxt).str()); 48 sb.append(m_arg1.execute(xctxt).str()); 49 50 if (null != m_arg2) 51 sb.append(m_arg2.execute(xctxt).str()); 52 53 if (null != m_args) 54 { 55 for (int i = 0; i < m_args.length; i++) 56 { 57 sb.append(m_args[i].execute(xctxt).str()); 58 } 59 } 60 61 return new XString(sb.toString()); 62 } 63 64 72 public void checkNumberArgs(int argNum) throws WrongNumberArgsException 73 { 74 if (argNum < 2) 75 reportWrongNumberArgs(); 76 } 77 78 84 protected void reportWrongNumberArgs() throws WrongNumberArgsException { 85 throw new WrongNumberArgsException(XSLMessages.createXPATHMessage("gtone", null)); 86 } 87 } 88 | Popular Tags |